This is a feature-rich Discord bot built using Python. The bot is designed to enhance your Discord server by providing fun interactions, moderation tools, and utility commands. The project is structured with a modular design, categorizing commands into different folders for better organization and scalability.
These commands interact with external APIs to fetch data or perform specific tasks:
- Cat Fact (
catfact.py
): Fetches a random cat fact to share in the server. - Define (
define.py
): Retrieves definitions of words using a dictionary API. - Joke (
joke.py
): Sends a random joke to lighten the mood.
These commands are designed for debugging and bot monitoring:
- Eval (
eval.py
): Executes Python code snippets and returns the result (admin-only command). - Status (
status.py
): Provides the bot's status, including uptime and server count.
Commands that engage users with entertaining activities:
- 8-Ball (
8ball.py
): Responds to questions with classic 8-ball predictions. - Flip (
flip.py
): Simulates flipping a coin (heads or tails). - Meme (
meme.py
): Fetches random memes from meme API. - Roll (
roll.py
): Rolls a virtual die with customizable sides.
Commands that provide useful information or general utilities:
- Help (
help.py
): Lists all available bot commands with brief descriptions. - Server Info (
serverinfo.py
): Displays detailed information about the current server, such as server name, member count, and creation date. - Test (
test.py
): Verifies the bot's functionality, ensuring it is working properly. - Uptime (
uptime.py
): Shows how long the bot has been running since its last restart. - User Info (
userinfo.py
): Displays detailed information about a specified user, such as username, roles, and join date.
Commands to manage users and maintain order in the server:
- Ban (
ban.py
): Bans a disruptive user from the server. - Kick (
kick.py
): Kicks a user from the server temporarily without banning them. - Purge (
purge.py
): Deletes a specified number of messages from a channel to clear spam or unnecessary messages. - Unban (
unban.py
): Unbans a previously banned user and allows them back into the server.
Commands that provide additional helpful features for server members:
- Poll (
poll.py
): Creates a poll where users can vote on options for a specific question. - Reminder (
reminder.py
): Sets a reminder for the user to notify them at a specified time. - Weather (
weather.py
): Fetches and displays the current weather for a specified location.
Below is the file structure of the project for easy navigation:
commands/
├── api/
│ ├── catfact.py
│ ├── define.py
│ └── joke.py
├── dev/
│ ├── eval.py
│ └── status.py
├── fun/
│ ├── 8ball.py
│ ├── flip.py
│ ├── meme.py
│ └── roll.py
├── general/
| ├── help.py
│ ├── serverinfo.py
│ ├── test.py
| ├── uptime.py
│ └── userinfo.py
├── moderation/
| ├── ban.py
│ ├── kick.py
| ├── purge.py
│ └── unban.py
├── utility/
│ ├── roll.py
| ├── reminder.py
| └── weather.py
screenshots/
├── poll.png
├── serverinfo.png
├── status.png
├── userinfo.png
└── weather.png
.env
.gitignore
8ball.txt
discord.log
main.py
README.md
requirements.txt
Ensure you have the following installed on your system:
- Python 3.8 or higher
- pip (Python package manager)
- Clone this repository to your local machine:
git clone https://github.com/KonyD/discord-bot.git
cd discord-bot
- Install the required dependencies:
pip install -r requirements.txt
- Create a .env file in the root directory and add your bot token and openweather API key(If you don't add your api key you can't use the
$weather
command):
TOKEN=your_bot_token_here
API_KEY=your_api_key_here
- Run the bot:
python main.py
These commands interact with external APIs to fetch data or provide information dynamically:
-
Cat Fact (catfact.py)
- Description: Retrieves a random cat fact from an external API and sends it to the Discord channel.
- Use Case: Ideal for fun interactions, especially for cat lovers.
- Example:
$catfact
- Output:
"A cat’s whiskers are generally about the same width as its body."
-
Define (define.py)
- Description: Looks up the definition of a word using a * dictionary API and returns the meaning.
- Use Case: Helps users quickly find the definition of unfamiliar words.
- Example:
$define programming
- Output:
"Programming: The process of creating a set of instructions that tell a computer how to perform a task."
-
Joke (joke.py)
- Description: Fetches a random joke from a jokes API and sends it to the channel.
- Use Case: Perfect for lightening the mood during server conversations.
- Example:
$joke
- Output:
"Why did the scarecrow win an award? Because he was outstanding in his field!"
These commands are designed for developers to debug and monitor the bot's functionality:
-
Eval (eval.py)
- Description: Executes Python code snippets and returns the result.
- Note: Restricted to bot developers or admins.
- Use Case: Useful for testing small code snippets or evaluating logic directly via Discord.
- Example:
$eval 2 + 2
- Output:
4
-
Status (status.py)
These commands are designed to entertain and engage server members:
-
8-Ball (8ball.py)
- Description: Simulates a magic 8-ball, answering user questions with randomized responses.
- Use Case: Adds a fun and interactive element to server conversations.
- Example:
$8ball Will I win the lottery?
- Output:
"It is certain."
-
Flip (flip.py)
- Description: Flips a virtual coin and displays the result (Heads or Tails).
- Use Case: Useful for making decisions or just having fun.
- Example:
$flip
- Output:
"🪙 Heads"
-
Meme (meme.py)
- Description: Fetches a random meme from a meme API and shares it in the channel.
- Use Case: Fun for creating engagement by sharing popular memes.
- Example:
$meme
- Output:
[Random Meme Image]
-
Roll (roll.py)
- Description: Rolls a virtual die and returns a random number based on the specified number of sides.
- Use Case: Great for games or deciding outcomes with random rolls.
- Example:
!roll 6
- Output:
"🎲 You rolled: 4"
These commands provide information and general utilities for the server:
-
Help (help.py)
- Description: Lists all available bot commands with a brief description.
- Use Case: Helps users navigate the bot's functionality.
- Example:
$help
-
Server Info (serverinfo.py)
-
Test (test.py)
- Description: A simple command to test if the bot is working properly.
- Use Case: Verifies bot functionality during debugging or setup.
- Example:
!test
- Output:
"Test command executed!"
-
Uptime (uptime.py)
- Description: Shows how long the bot has been running since its last restart.
- Use Case: Useful for checking the bot's reliability and runtime.
- Example:
!uptime
- Output:
01:02:49
-
User Info (userinfo.py)
These commands are for server moderators to manage users and maintain order:
-
Ban (ban.py)
- Description: Bans a user from the server.
- Use Case: Removes disruptive users from the server.
- Example:
$ban <User ID>
- Output:
"
User Name
has been banned fromGuid Name
." -
Kick (kick.py)
- Description: Kicks a user from the server.
- Use Case: Removes a user temporarily without banning them.
- Example:
$kick <User ID>
- Output:
"
User Name
has been kicked fromGuid Name
." -
Purge (purge.py)
- Description: Deletes a specified number of messages from a channel.
- Use Case: Quickly clears spam or unnecessary messages.
- Example:
$purge 10
- Output:
"Cleared 10 messages by
Author Name
." -
Unban (unban.py)
- Description: Unbans a previously banned user.
- Use Case: Allows users back into the server after resolving issues.
- Example:
$unban <User ID>
- Output:
"Unbanned
User Name
(ID:User ID
)."
These commands provide additional helpful features:
-
Poll (poll.py)
-
Reminder (reminder.py)
- Description: Sets a reminder for the user at a specified time.
- Use Case: Helps users keep track of tasks or events.
- Example:
$remindme 2h Take a break
- Output:
"Reminder set for 2h from now!"
-
Weather (weather.py)
This project is licensed under the MIT License. See the LICENSE file for details.