- Introduction
- Features
- Requirements
- Installation
- Configuration
- Running the Bot
- Commands
- Contributing
- License
This Discord bot is a multi-functional assistant with features such as YouTube audio playback, random meme generation, AI-powered text generation, user timeouts, and fun chat interactions. It leverages the Discord API, Hugging Face's GPT-Neo model, and various public APIs for its functionality.
- 🎶 Play YouTube Audio: Plays audio from YouTube videos in voice channels.
- 🤖 AI-Powered Text Generation: Generates responses using Hugging Face's GPT-Neo model.
- 😂 Random Memes: Fetches memes from a meme API.
- 🛑 User Timeouts: Temporarily mutes users for specified durations.
- 🎲 Fun Commands: Includes dice rolls, coin flips, and other interactive chat features.
- 🎄 Seasonal Updates: Updates bot status for special occasions like Christmas.
- Python 3.8 or later
discord.py
libraryyoutube-dl
oryt-dlp
for audio playback- Public APIs like Hugging Face and Meme API
.env
file to store sensitive data like bot tokens and API keys
-
Clone the Repository:
git clone https://github.com/your-repo-name/discord-bot.git cd discord-bot
-
Install Dependencies: Install required Python libraries using pip:
pip install -r requirements.txt
-
Set Up Environment Variables: Create a
.env
file in the root directory and add the following:DISCORD_BOT_TOKEN=your_discord_bot_token HUGGINGFACE_API_KEY=your_hugging_face_api_key
-
Verify Installation: Ensure all dependencies are installed and the
.env
file is properly configured.
-
Bot Token:
- Get your bot token from the Discord Developer Portal.
- Add the token to the
.env
file.
-
Hugging Face API Key:
- Obtain your API key from Hugging Face.
- Add the key to the
.env
file.
-
Voice Channel Permissions:
- Ensure your bot has the necessary permissions in your Discord server:
- Manage Channels
- Connect
- Speak
- Timeout Members (optional for timeout features)
- Ensure your bot has the necessary permissions in your Discord server:
- Start the bot by running:
python3 bot.py
- The bot will log in and display its status in the console.
Here’s a list of available commands and their usage:
Command | Description |
---|---|
!llm |
Generates a response using Hugging Face's GPT-Neo model. Example: !llm Write a poem. |
!play |
Plays YouTube audio in a voice channel. Example: !play <YouTube URL> |
!stop |
Disconnects the bot from the voice channel. |
!timeout |
Times out a user for a random duration. Example: !timeout @username |
!meme |
Fetches and displays a random meme. |
!dice roll |
Rolls a dice and returns a random number between 1 and 6. |
!coin flip |
Flips a coin and returns "Heads" or "Tails". |
!hello |
Responds with a greeting. |
!good night |
Responds with a good night message. |
We welcome contributions! If you'd like to contribute:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with a detailed description of your changes.
This project is open-source and available under the MIT License. See the LICENSE file for more details.
- Bot not starting? Check your
.env
file for the correct token and API keys. - Permissions error? Ensure the bot has the required permissions in your server.
- Dependencies issue? Reinstall requirements with
pip install -r requirements.txt
.