Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/retr0327/discord-bot
A simple and multipurpose Discord bot.
https://github.com/retr0327/discord-bot
discord-bot discord-py python3 scheduled-tasks scheduler
Last synced: 12 days ago
JSON representation
A simple and multipurpose Discord bot.
- Host: GitHub
- URL: https://github.com/retr0327/discord-bot
- Owner: Retr0327
- License: apache-2.0
- Created: 2023-02-07T12:46:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-15T02:01:24.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T10:30:54.622Z (about 2 months ago)
- Topics: discord-bot, discord-py, python3, scheduled-tasks, scheduler
- Language: Python
- Homepage:
- Size: 79.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **discord-bot**
This project builds a simple Discord bot which was designed to make our Discord life easier and cooler.
## **Features**
- `/echo `: Echo the same message content to the user
- `/ban [reason]`: Ban user
- `/kick [reason]`: Kick user
- `/brodcast `: Send the scheduled message to a channel
- `/unbrodcast `: Remove the scheduled message from a channel
- `/clear `: Clear the chat history of a channel
- `/text_channel `: Create a channel
- `/rm_text_channel `: Delete a channel
- `/send_to `: Send the message to a specific channel> `[arg]`: optional argument; ``: required arugment
## **Setup**
### 1. Installation1. Python version
* `python >= 3.10`2. Clone repository
```bash
git clone [email protected]:Retr0327/discord-bot.git
```3. Install Requirement
```bash
cd discord-bot && pip install -r requirements.txt
```### 2. Environment variables
Please create a `.env` file under the current folder `/discord-bot`:```env
TOKEN=[discord-bot-token]
GUILD=[discord-channel-id]
```### 3. Start the bot
There are two main ways to run the bot:- in Python
First make sure you are in the `discord-bot` folder, and then simply run:```bash
python ./bot/bot.py
```
or
```bash
python -u "./bot/bot.py"
```- run in Docker
Install Docker, and use the following command to run:
```bash
docker compose up
```## Commands Guide
> This bot accepts only slash commands### 1. User related
#### `/echo `
Echo the exact same message content back to the user, providing a response to their original message.#### `/ban [reason]`
Impose a mute on a particular user, preventing he/she from sending messages in a specified channel. You can optionally supply a `reason` argument to specify the reason for the mute.#### `/kick [reason]`
Remove a specific user from a channel. You can optionally supply a `reason` argument to specify the reason for kicking he/she out.### 2. Channel related
#### `/brodcast `
Regularly send messages to a specific channel. Here is the overview of the brodcasting architecture:```mermaid
flowchart RL
subgraph DB
direction LR
g[("SQLite")]
endB[Schedule request] --> C((Bot event loop))
C -- Trigger callback --> B
C -- Register callback --> DB
DB -- Operation complete --> C
```When a user broadcasts a message to a particular channel, the Discord bot logs the task in its event loop. Upon restart, the bot examines the database for any pending tasks and incorporates them into the loop if any are found.
#### `/unbrodcast `
Remove the scheduled message from a channel. In other words, the Discord bot will cancel the scheduled task from its event loop.#### `/clear `
Clear the chat history of a specific channel.#### `/text_channel `
Create a Discord text channel.#### `/rm_text_channel `
Delete a Discord text channel.#### `/send_to `
Send the message to a specific channel.## Contact Me
If you have any suggestion or question, please do not hesitate to email me at [email protected]