Compare commits
1 Commits
55b16529b5
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ccc944ef84 |
@@ -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.")
|
||||
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__":
|
||||
|
||||
Reference in New Issue
Block a user