Eve-Time is a simple Discord bot created to fetch and display the current time in various time zones, including the Eve Online time (UTC).
- Fetch the current UTC time (Eve Online time).
- Display the current time in various US time zones (EST, CST, MST, PST).
- Enhanced error handling to gracefully handle unexpected issues and provide informative feedback.
- Integrated logging mechanism that tracks both regular and error activities, making debugging and tracking easier.
To ensure that the bot runs smoothly, you must install a few dependencies. Here's a list of everything you'll need:
This is the main library that allows our script to interact with the Discord API.
pip install discord.py
While it's a built-in module in Python, you might need it to handle date and time functionalities.
This library allows you to work with time zones.
pip install pytz
Useful for extracting configuration values from .env
files.
pip install python-decouple
-
Clone the repository:
git clone https://github.com/kaspaeve/Eve-Time.git
-
Navigate to the project directory:
cd Eve-Time
-
Create a
.env
file in the root directory and add your Discord bot token and the ID of the allowed channel:BOT_TOKEN=Your_Discord_Bot_Token ALLOWED_CHANNEL_ID=Your_Allowed_Channel_ID FEED_CHANNEL_ID=Your_patch_notes_Channel_ID
- Execute the Python script:
python chuck.py
Once the bot is running, use the !time
command in the allowed channel to fetch and display the current time.
Note: Ensure you have the necessary Python packages installed and the environment properly set up to run the bot.
Deploying the Eve-Time bot using Docker and docker-compose
simplifies the process by handling the dependencies and ensuring consistent behavior across different environments.
-
Clone the repository:
git clone https://github.com/kaspaeve/Eve-Time.git
-
Navigate to the project directory:
cd Eve-Time
-
Ensure your
.env
file is set up in the root directory with the necessary values:BOT_TOKEN=Your_Discord_Bot_Token ALLOWED_CHANNEL_ID=Your_Allowed_Channel_ID
-
Use Docker Compose to build and start the bot:
docker-compose up --build -d
The
--build
flag ensures that the Docker image is built using the provided Dockerfile, and the-d
flag runs the container in detached mode. -
Check the bot logs (if necessary):
docker-compose logs -f
The
-f
flag lets you follow the logs in real-time. -
Stopping the bot:
docker-compose down
This approach ensures that your bot runs in an isolated environment, making it less susceptible to discrepancies between development and production environments.
services:
eve-time-bot:
image: kaspa101/eve-time:latest
environment:
- BOT_TOKEN=your_bot_token
- ALLOWED_CHANNEL_ID=your_allowed_channel_id