Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/taaku18/discord-message-scheduler

A simple Discord Bot that can send scheduled messages.
https://github.com/taaku18/discord-message-scheduler

discord discord-bot discord-modals discord-py message-scheduler

Last synced: 4 days ago
JSON representation

A simple Discord Bot that can send scheduled messages.

Awesome Lists containing this project

README

        




Logo

Discord Message Scheduler



GitHub tag


GitHub commit activity


Forks


Stars


Issues


License


Code Factor code quality


pre-commit


Docker hub Version


A simple Discord Bot that can send scheduled messages.


Explore the docs »




Report Bug
·
Request Feature


Table of Contents



  1. About The Project



  2. Getting Started


  3. Commands Guide

  4. Roadmap

  5. Contributing

  6. License

  7. Contact

  8. Acknowledgments

## About The Project

![Schedule creator screenshot][product-screenshot]

Discord Message Scheduler provides a convenient bot interface to grant users the ability to create scheduled messages via the bot.

(back to top)

### Features

* Supports both prefixed and slash commands
* Uses SQLite database
* Modern Discord Modal interface
* Easy to set up
* Docker support

### Built With

[![Python][Python.org]][Python-url] [![discord.py][Discord.py]][Discordpy-url]

(back to top)

## Getting Started

Follow these instructions to deploy your own Discord Message Scheduler bot.

### Prerequisites

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/](https://www.python.org/downloads/).
* Using [Homebrew](https://brew.sh) (MacOS/Linux):
```sh
brew install [email protected]
```
* Using APT (Debian/Ubuntu):
```sh
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.
1. Create a Discord application at [https://discord.com/developers/applications](https://discord.com/developers/applications)
2. Within the settings page, navigate to the **Bot** tab and create a bot
3. (Optional) If you don't want others to invite your bot, then disable **PUBLIC BOT**.
4. Enable **SERVER MEMBERS INTENT** and **MESSAGE CONTENT INTENT** under the Privileged Gateway Intents settings
5. 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
6. Open the link in the **Generated URL** box at the bottom to invite your bot.

### Installation

1. Clone or [download](https://github.com/Taaku18/discord-message-scheduler/archive/refs/heads/main.zip) the repo
```sh
git clone https://github.com/Taaku18/discord-message-scheduler.git
```
2. Install Python dependencies, choose a method from below:
1. (Recommended) Using PDM
1. [Install PDM](https://pdm.fming.dev/latest/#recommended-installation-method)
2. Run `pdm install --prod -G speed --no-lock --no-editable`
2. Using pip
```sh
python3.10 -m pip install -U pip
python3.10 -m pip install -U -r requirements.txt
```
3. Rename `.env.example` to `.env` and replace `BOT-TOKEN` with your bot's token and `BOT-PREFIX` with your desired bot prefix.
Example `.env` file:
```dotenv
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.

(back to top)

## Usage

To start the bot, simply run:
```sh
python3.10 start.py
```

(back to top)

## Docker (experimental)

[![Docker Pulls][docker-pulls-shield]][docker-pulls-url]
[![Docker Size][docker-size-shield]][docker-size-url]

Alternatively, you can use Docker to deploy this bot.

Ensure you have the latest version of [Docker](https://docs.docker.com/get-docker/) installed (v19.03.0+). You will also need the [Docker Compose Plugin](https://docs.docker.com/compose/install/compose-plugin/).

> Pre-built images are provided at [taaku18/dms](https://hub.docker.com/repository/docker/taaku18/dms).

1. Clone or [download](https://github.com/Taaku18/discord-message-scheduler/archive/refs/heads/main.zip) the repo
```sh
git clone https://github.com/Taaku18/discord-message-scheduler.git
```
2. Rename `.env.example` to `.env` and set your environment variables (see step 3 above)
3. Deploy your bot (this will use the pre-built image provided for `amd64` and `arm64`)
```sh
docker pull taaku18/dms:stable
docker compose up -d
```
If you wish to build your own image instead, replace `taaku18/dms:stable` with `dms:latest` in `docker-compose.yml`. Then run
```sh
docker 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.
```sh
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 `.

### Docker Tags

- `latest` - the most recent commit on `main`
- `stable` - the most recent published tag commit
- `x.y.z` - version `x.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`.

(back to top)

## Commands Guide

This bot accepts both prefixed and slash commands.

Table of Contents


  1. Schedule related:


  2. General:


> The default bot prefix is `=`.

`[arg]` - Optional
`` - Required

### `/schedule create [channel]`

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`
- `Timezone` - The timezone to parse your time.

Formats:
- Formal [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones): `America/Los_Angeles`, `Europe/Berlin`, `Asia/Shanghai`
- [Time zone abbreviation](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones): `GMT`, `UTC`, `CEST`, `PDT`, `EST`, `ET` (not recommended, may be inaccurate)
- Timezone offset: `+12:30`, `-3000`, `+0123`, `UTC+1232`, `UTC-12:32`
- `Repeat` - The number of minutes between every repeat of the scheduled message. Set `0` to disable.

### `/schedule list [channel]`

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.

### `/schedule show `

Shows you the full details of a scheduled message. To find the `event-id`, use the [`/schedule list`](#schedule-list-channel) command.

### `/schedule edit [new-channel]`

> 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`](#schedule-list-channel) command.

To change the current channel, set `new-channel` to the channel that you want.

### `/schedule delete `

Deletes/un-schedules an upcoming scheduled message. To find the `event-id`, use the [`/schedule list`](#schedule-list-channel) command.

### `/info`

Shows info about this bot.

### `=help [category-or-command]`

> 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.

(back to top)

## Roadmap

- [x] Basic help and schedule command interfaces
- [x] Create a Docker image
- [x] Implement list/delete command
- [ ] Allow server staff access to these commands
- [ ] Implement reporting interface to remove abusive scheduled messages
- [ ] Permissions system
- [x] Add GitHub workflow for testing, linting, building Docker image
- [x] 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](https://github.com/github_username/repo_name/issues) for a full list of proposed features (and known issues).

(back to top)

## Contributing

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!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. If you made any code changes, use `black .` to format the code
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Branch (`git push origin feature/AmazingFeature`)
6. Open a Pull Request

We use [PDM](https://pdm.fming.dev/latest/) as our dependency manager. See their [installations page](https://pdm.fming.dev/latest/#recommended-installation-method) on how to install this tool.
* Add package: `pdm add `
* Update package: `pdm update `
* Remove package: `pdm remove `
* Install dependencies: `pdm sync --clean -G:all` (this will also remove all non-project dependencies)

Optionally add `-dG ` (development group) or `-G ` (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
```sh
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](https://pre-commit.com/).
It's recommended to install `pre-commit` by following the [quick start guide](https://pre-commit.com/#quick-start) and run `pre-commit run -a` to run the pre-commit actions.

(back to top)

## License

Distributed under GNU General Public License v3.0. See `LICENSE.txt` for more information.

(back to top)

## Contact

Contact me via Discord:

Taku - [taku#3343](https://discord.com/)

Project Link: [https://github.com/Taaku18/discord-message-scheduler](https://github.com/Taaku18/discord-message-scheduler)

(back to top)

## Acknowledgments

* Inspired by [bjsbrar/DiscordMessageScheduler](https://github.com/bjsbrar/DiscordMessageScheduler)

(back to top)

[docker-pulls-shield]: https://img.shields.io/docker/pulls/taaku18/dms?color=E78963
[docker-pulls-url]: https://hub.docker.com/r/taaku18/dms
[docker-size-shield]: https://img.shields.io/docker/image-size/taaku18/dms?color=6661AB
[docker-size-url]: https://hub.docker.com/r/taaku18/dms
[product-screenshot]: docs/demo.gif
[Python.org]: https://img.shields.io/badge/Python-3.10-45697E?style=for-the-badge&logo=python&logoColor=white
[Python-url]: https://python.org
[Discord.py]: https://img.shields.io/badge/discord.py-0769AD?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAIrklEQVRYw61X+1NTZxo+8F/woyTkQgJJSM45QeSSixAu4SJahSpqvSAQkKso2nZ3rVqmW9dWIHhp1VKdqlQE62id3c4OrfXSWuttJVwE23GmZfoT3Rm3xfDs+30nJES0ujObmWcOIeec53nv7ycIz/jgXo6Af80i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KTwMJozjqeHvHhjsxgqF4JGA11KGtX4ciRRWHS29Hnzn2POOsaqoH5dCt+mUkVd+B4+jp1L2RSMHsd8IRkrCS8kj77KwdKCpMhColZHlhH1izckRrYgVKpzu5/OlgHrunfIemUhkXz7YyIb0VMr2a1zLj5G/18rmdZsR8qqv/CVTOQrWXecshN2hZbSsflL6a0BB0rzkigf1C9l+XwozzHLUyp28qVUoqWU1nJaSg9EltLnreVPhgqwp6sZhuwKvn69bAhmQ6bRGXjDYXvgH67lzzyYPHCLZwaaBx1/Usow5bV2GByl1OfNColKNScv5oB+Y3uiIaMQlldf51bLzziYSE8fTOYezaaHCoTzFxoFU+vFOLntXDsNokm2E7BZb6URaqKJyJbTxLQ82nSdfFll49VIlWJasllJNCKVGz6i65FJsj7qaCbWvuCQ+svNUkFYPiZkvdknSNsHYqgjyjR2/dSUxgnTzCN86WiivYCR0FhmV7npuILGnmm54di4XH/UL28+IpOYGBIhMLzwcDr7EV8fEOTtCkiAYG/tiyVyPW1APmpKvSQgIG85NUVLSFBq/iQoN52YIvKA1NjTS2J8UsMxvb3haCwJ4MQk4rnH8/8CmJyMTDqH+n8AAAAASUVORK5CYII=
[Discordpy-url]: https://github.com/Rapptz/discord.py