From ccc944ef8462205606b90409df1b3029a425eda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20L=27abb=C3=A9?= Date: Sun, 31 May 2026 12:35:26 +0000 Subject: [PATCH] revert iteratePrefix --- bot.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 81a2348..743223d 100755 --- a/bot.py +++ b/bot.py @@ -2,6 +2,7 @@ import discord from discord.ext import commands import os +import sys from dotenv import load_dotenv from utils.sql_commands import initialize_database @@ -17,12 +18,17 @@ class MyNewHelp(commands.MinimalHelpCommand): class Client(commands.Bot): def __init__(self): super().__init__( - command_prefix=["Vamoc", "!V"], + command_prefix=self.iterate_prefix("Vamoc")+self.iterate_prefix("!V"), strip_after_prefix=True, case_insensitive=True, intents=discord.Intents.all(), help_command=MyNewHelp(), ) + def iterate_prefix(self, prefix): + prefixes = list(map(''.join, itertools.product(*zip(prefix.upper(), prefix.lower())))) + print(prefixes) + + return prefixes async def setup_hook(self): # overwriting a handler cogs_folder = f"{os.path.abspath(os.path.dirname(__file__))}/cogs" @@ -40,10 +46,12 @@ def main(): load_dotenv() initialize_database() client = Client() - token = os.getenv("DISCORD_TOKEN") or os.getenv("TOKEN") - if not token: - raise SystemExit("ERROR: Discord token not found. Set DISCORD_TOKEN or TOKEN in environment.") - client.run(token) + token = os.getenv("TOKEN") + if token is not None: + threading.Thread(target=run_web, daemon=True).start() + client.run(token) + else: + print("Token is missing.") if __name__ == "__main__":