Custom Commands docsCustom CommandsDocs

Search docs

Find a page, function or guide

HomeSupportDashboard

Getting started

  • Introduction
  • Your first command
  • How a command runs
  • Variables in replies
  • Text commands
  • Events
  • Using Slushy

Guides

  • Welcome messages
  • Role menus
  • Auto moderation
  • Social alerts
  • Moderation commands
  • Levels and XP
  • Economy and coins
  • Ticket system
  • Giveaways
  • Poll
  • Button game
  • Reminders

Concepts

  • Buttons and menus
  • Forms
  • Saving data
  • Permissions and cooldowns
  • Limits and premium
  • Common mistakes

API reference

  • Response
  • Messages
  • Embeds
  • Members and roles
  • Channels
  • Storage
  • Checks
  • Views
  • Components
  • Modals
  • Interactions
  • Paginators
  • Web and files
  • Scheduling
  • Server events and polls
  • Time
  • Waiting
  • Utilities
  • Objects
  • Event variables

Examples

  • /8ball
  • /coinflip
  • /avatar
  • /serverinfo
  • /rank
  • /remind

API reference

View .md

Server events and polls

Create Discord server events and native polls from a command.

A server event is the event Discord shows at the top of the channel list, with a date and an "Interested" button. A poll is Discord's own vote message.

Write await in front of every function on this page.

The bot needs the Create Events or Manage Events permission for events, and Send Messages for polls.

create_event#

Creates a server event. Returns the event.

python
await create_event(
    name,
    start_time,
    type="external",
    end_time=None,
    location=None,
    channel=None,
    description=None,
    image=None,
)
ArgumentWhat it does
nameThe event name.
start_timeWhen it starts, like "saturday 8pm". Must be in the future.
typeexternal, voice or stage.
end_timeWhen it ends. Must be after the start.
locationWhere it is, as text. Only for external.
channelThe voice or stage channel. Only for voice and stage.
descriptionMore details about the event.
imageA cover image.

What each type needs:

typeNeeds
externallocation and end_time
voicechannel
stagechannel

Example: a movie night in a voice channel

python
ev = await create_event(
    "Movie night",
    "friday 9pm",
    type="voice",
    channel="Cinema",
    description="Bring snacks.",
)
set_content(f"Event made: **{ev.name}**")

Example: an event outside Discord

python
await create_event(
    "Meetup",
    "next saturday 2pm",
    location="Central Park",
    end_time="next saturday 5pm",
)

edit_event#

Changes an event. Pass only what you want to change.

python
await edit_event(
    event,
    name=None,
    start_time=None,
    end_time=None,
    location=None,
    channel=None,
    description=None,
)

event is the event, or its ID. Fails with "Nothing to edit" when you pass no changes.

python
await edit_event(event_id, start_time="friday 10pm")

cancel_event#

Deletes an event.

python
await cancel_event(event)

start_event#

Marks an event as started.

python
await start_event(event)

end_event#

Marks an event as ended.

python
await end_event(event)

Tip

Save the event ID with update_server_var("movie_event", ev.id). Then other commands can edit, start or end it.

create_poll#

Posts a Discord poll. Returns the poll message.

python
await create_poll(question, answers, channel=None, duration=24, multiselect=False)
ArgumentWhat it does
questionThe question. Up to 300 characters.
answersA list of 2 to 10 answers. Each up to 55 characters. Extra answers are dropped.
channelWhere to post. Defaults to the current channel.
durationHow long the poll stays open, in hours. 1 to 768 (32 days).
multiselectTrue lets people pick more than one answer.
python
await create_poll(
    "Which game tonight?",
    ["Minecraft", "Among Us", "Valorant"],
    duration=4,
)
set_content("Poll is up!")

To open a poll later, use schedule("create_poll", ...). See Scheduling. For a full walk-through, see the Poll guide.

PreviousSchedulingNext Time

On this page

  • create_event
  • edit_event
  • cancel_event
  • start_event
  • end_event
  • create_poll
Custom CommandsCustom Commands

The #1 Custom Commands Discord bot — build commands, events and databases with zero boilerplate.

Join the support server

Product

  • Overview
  • Why us?
  • Premium
  • Template shop

Features

  • AI Agent
  • Reaction roles
  • Welcome messages
  • Embed builder
  • Social alerts
  • Custom bot

Resources

  • Docs
  • Blog
  • Support
  • Dashboard

Company

  • Privacy
  • Terms
  • Contact
contact@ccbot.app

2 Frederick Street, London, WC1X 0ND

Payments secured by Stripe

© WEiRDSOFT LTD. All rights reserved.

Custom Commands