From 1e5cfd75eb3b299ce9b790858e92bb9eece08c5d Mon Sep 17 00:00:00 2001 From: kqcl Date: Mon, 27 Oct 2025 21:21:10 +0100 Subject: [PATCH] optimised bot setup for performance and added requirements --- .env.example | 1 + main.py | 9 ++++++--- requirements.txt | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .env.example create mode 100644 requirements.txt diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..bfb6be5 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +BOT_TOKEN= diff --git a/main.py b/main.py index 0a0260e..eef6d72 100644 --- a/main.py +++ b/main.py @@ -1,15 +1,18 @@ +import os import discord from discord.ext import commands +from dotenv import load_dotenv # ====== CONFIG ====== -TOKEN = "bot_token" # it is adviced to use environmental variables (.env) to store your token for safety -USER_IDS = [123456789012345678, 987654321098765432] # IDs of users to react to +load_dotenv() +TOKEN = os.getenv("BOT_TOKEN") or "bot_token" # it is adviced to use environmental variables (.env) to store your token for safety + +USER_IDS = {123456789012345678, 987654321098765432} # IDs of users to react to EMOJI = "<:cool:123456789012345678>" # Custom emoji # ===================== intents = discord.Intents.default() intents.message_content = True -intents.messages = True intents.guilds = True bot = commands.Bot(command_prefix="!", intents=intents) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0e34cd7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +discord.py>=2.5.1 +python-dotenv>=1.0.0