A Discord bot designed to bring fun and interaction to any server
meowBot is a Discord bot designed to bring a bit of fun and interaction to any server. Hosted on Google Cloud Platform and using SQLite for database management, this bot simulates a virtual cat that responds to various triggers and allows users to interact with it through a petting feature.
Project Overview
meowBot offers a range of functionalities:
- Cat Trigger Responses: Responds with randomly generated cat-related messages when triggered by certain keywords.
- Pet Tracker: Users can “pet” the virtual cat every 30 minutes, receiving a random number between 1 and 100 with different rarities. The bot tracks each user’s total pet counts and prevents exploitation with a cooldown.
- Leaderboard: Displays a leaderboard of users with the highest pet counts.
- Pet Timer: Notifies users of when they can pet the virtual cat again.
Key Features
- Random Responses: The bot generates random responses to cat-related triggers like “meow,” “mrow,” and “:3”.
- Petting Mechanism: Each pet command returns a randomly generated number of additional pets, tracked per user.
- Leaderboard: Shows the top users with the most pet counts in the server.
- Cooldown Timer: Prevents users from spamming pet commands by enforcing a 30-minute cooldown.
How It Works
- Setup: The bot connects to a SQLite database to manage pet statistics. It creates a table to store user data, including pet counts and last petting times.
- Message Handling: Responds to commands:
!pet
– Allows users to pet the cat and updates their pet count.!petleaderboard
– Shows the top users with the most pets.!pettimer
– Informs users when they can pet the cat again.
- Trigger Responses: Sends a random cat-related response when specific triggers are detected in message content.
Code Explanation
- Database Management: Uses SQLite to store and retrieve pet statistics. The
pet_stats
table holds data on pet counts and last petting times. - Bot Events: Listens for messages and handles commands to interact with the virtual cat.
- Randomness: Utilizes the
random
module to generate responses and determine the number of pets added.
Getting Started
- Clone this repository.
- Set up a Google Cloud Platform project and configure your environment to run the bot.
- Install required Python libraries:
pip install discord sqlite3 python-dotenv
- Create a
.env
file in the root directory and add your Discord API key:
DISCORD_API_KEY=your_discord_api_key_here
- Run the bot:
python meow_bot.py
Prerequisites
- Python 3.x
- Discord API account and token
- Google Cloud Platform account for hosting
Contributing
Contributions to improve meowBot are welcome! Feel free to reach out for improvements and advancements.