A simple Discord Bot that can send scheduled messages.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
Discord Message Scheduler provides a convenient bot interface to grant users the ability to create scheduled messages via the bot.
- Supports both prefixed and slash commands
- Uses SQLite database
- Modern Discord Modal interface
- Easy to set up
- Docker support
Follow these instructions to deploy your own Discord Message Scheduler bot.
This bot is build on Python 3.10. You will need to download the latest version of Python using any of the methods below.
- From official website (Any OS): https://www.python.org/downloads/.
- Using Homebrew (MacOS/Linux):
brew install [email protected]
- Using APT (Debian/Ubuntu):
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.10 python3.10-dev software-properties-common curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
You will also need a Discord bot.
- Create a Discord application at https://discord.com/developers/applications
- Within the settings page, navigate to the Bot tab and create a bot
- (Optional) If you don't want others to invite your bot, then disable PUBLIC BOT.
- Enable SERVER MEMBERS INTENT and MESSAGE CONTENT INTENT under the Privileged Gateway Intents settings
- Navigate to Oauth2 → URL Generator tab, click both bot and applications.commands, and check the following buttons:
- Read Messages/View Channels
- Send Messages
- Send Messages in Thread
- Send TTS Messages
- Embed Links
- Attach Files
- Read Message History
- Mention Everyone
- Use External Emojis
- Use External Stickers
- Add Reactions
- Use Slash Commands
- Open the link in the Generated URL box at the bottom to invite your bot.
- Clone or download the repo
git clone https://github.com/Taaku18/discord-message-scheduler.git
- Install Python dependencies, choose a method from below:
- (Recommended) Using PDM
- Install PDM
- Run
pdm install --prod -G speed --no-lock --no-editable
- Using pip
python3.10 -m pip install -U pip python3.10 -m pip install -U -r requirements.txt
- (Recommended) Using PDM
- Rename
.env.example
to.env
and replaceBOT-TOKEN
with your bot's token andBOT-PREFIX
with your desired bot prefix. Example.env
file:TOKEN=VTDkXNDUzC3KyFoIxNzYx2_d4OQ.PK5K1A.9p0q3Kdi26j0eCa_vu3Ke_39KsL3Kkso83E_gB0 PREFIX=? SYNC_SLASH_COMMANDS=on
SYNC_SLASH_COMMANDS
should be set to "on" the first time you start the bot and every time you update. It should be set to "off" during normal usage since syncing slash commands may take a long time.
To start the bot, simply run:
python3.10 start.py
Alternatively, you can use Docker to deploy this bot.
Ensure you have the latest version of Docker installed (v19.03.0+). You will also need the Docker Compose Plugin.
Pre-built images are provided at taaku18/dms.
- Clone or download the repo
git clone https://github.com/Taaku18/discord-message-scheduler.git
- Rename
.env.example
to.env
and set your environment variables (see step 3 above) - Deploy your bot (this will use the pre-built image provided for
amd64
andarm64
)If you wish to build your own image instead, replacedocker pull taaku18/dms:stable docker compose up -d
taaku18/dms:stable
withdms:latest
indocker-compose.yml
. Then rundocker build -t dms:latest . docker compose up -d
You can stop the bot by running docker compose down
.
To access your bot logs, run docker ps
. This will show a list of containers.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
58e6aao4c8bd dms:latest "python start.py" 14 seconds ago Up Less than a second discord-message-scheduler
Find the CONTAINER ID of the container named "discord-message-scheduler" and run docker logs <CONTAINER ID>
.
latest
- the most recent commit onmain
stable
- the most recent published tag commitx.y.z
- versionx.y.z
tag commit
The default tag is stable
. To use a different tag, replace the "stable" of taaku18/dms:stable
with your desired tag in docker-compose.yml
.
This bot accepts both prefixed and slash commands.
Table of Contents
- Schedule related:
- General:
The default bot prefix is
=
.
[arg]
- Optional
<arg>
- Required
Creates a scheduled message. You can optionally supply a channel
argument to specify a channel for the message.
A Discord modal prompt will open, asking for the following:
-
Message
- The message that the bot should send at the scheduled time. -
Scheduled Time
- The time to send the message, accurate to the second.Formats:
- Just date:
2/24/2023
(Month/Day/Year),December 12
,nov 26 2023
- Just time:
1:12am
,midnight
,13:42
,7pm
- Date and time:
02/24/23 19:31:03
- Other date formats:
March 30 2023 4:10pm
- Simple time:
tomorrow
,next week
,thursday at noon
- Slightly complicated relative time:
in 1 day, 2 hours and 10 minutes
- ISO 8601 format:
2023-08-11T01:59:41.981897
- Just date:
-
Timezone
- The timezone to parse your time.Formats:
- Formal TZ database name:
America/Los_Angeles
,Europe/Berlin
,Asia/Shanghai
- Time zone abbreviation:
GMT
,UTC
,CEST
,PDT
,EST
,ET
(not recommended, may be inaccurate) - Timezone offset:
+12:30
,-3000
,+0123
,UTC+1232
,UTC-12:32
- Formal TZ database name:
-
Repeat
- The number of minutes between every repeat of the scheduled message. Set0
to disable.
Shows you a list of upcoming scheduled messages. You can optionally supply a channel
argument to specify a channel to check for your upcoming scheduled messages.
Shows you the full details of a scheduled message. To find the event-id
, use the /schedule list
command.
Due to limitations with the bot, it is not possible to edit the time or timezone. You will need to delete and re-create the schedule event.
Edits the contents of an upcoming scheduled message. To find the event-id
, use the /schedule list
command.
To change the current channel, set new-channel
to the channel that you want.
Deletes/un-schedules an upcoming scheduled message. To find the event-id
, use the /schedule list
command.
Shows info about this bot.
This command is only available as a prefixed command.
Shows the help page. Optionally, set category-or-command
to be a category or command name to view more info on the subject.
Note: [category-or-command]
is case-sensitive.
- Basic help and schedule command interfaces
- Create a Docker image
- Implement list/delete command
- Allow server staff access to these commands
- Implement reporting interface to remove abusive scheduled messages
- Permissions system
- Add GitHub workflow for testing, linting, building Docker image
- Auto generate requirements.txt from PDM using pre-commit
- Revise pyright config, add to contributing guidelines
- Replace the README screenshot and add a bot logo
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - If you made any code changes, use
black .
to format the code - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
We use PDM as our dependency manager. See their installations page on how to install this tool.
- Add package:
pdm add <package name>
- Update package:
pdm update <package name>
- Remove package:
pdm remove <package name>
- Install dependencies:
pdm sync --clean -G:all
(this will also remove all non-project dependencies)
Optionally add -dG <group name>
(development group) or -G <group name>
(optional group) to the above commands if the package belongs to a specific group (ex. lint
, speed
).
When making dependencies changes, always export the requirements to requirements.txt
with
pdm export --pyproject --without-hashes --prod -G:all -o requirements.txt
To simplify some common processes, such as linting with black and generating requirements.txt
, we use pre-commit.
It's recommended to install pre-commit
by following the quick start guide and run pre-commit run -a
to run the pre-commit actions.
Distributed under GNU General Public License v3.0. See LICENSE.txt
for more information.
Contact me via Discord:
Taku - taku#3343
Project Link: https://github.com/Taaku18/discord-message-scheduler
- Inspired by bjsbrar/DiscordMessageScheduler