Compare commits
1 Commits
55b16529b5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ccc944ef84 |
@@ -2,6 +2,7 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from utils.sql_commands import initialize_database
|
from utils.sql_commands import initialize_database
|
||||||
|
|
||||||
@@ -17,12 +18,17 @@ class MyNewHelp(commands.MinimalHelpCommand):
|
|||||||
class Client(commands.Bot):
|
class Client(commands.Bot):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
command_prefix=["Vamoc", "!V"],
|
command_prefix=self.iterate_prefix("Vamoc")+self.iterate_prefix("!V"),
|
||||||
strip_after_prefix=True,
|
strip_after_prefix=True,
|
||||||
case_insensitive=True,
|
case_insensitive=True,
|
||||||
intents=discord.Intents.all(),
|
intents=discord.Intents.all(),
|
||||||
help_command=MyNewHelp(),
|
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
|
async def setup_hook(self): # overwriting a handler
|
||||||
cogs_folder = f"{os.path.abspath(os.path.dirname(__file__))}/cogs"
|
cogs_folder = f"{os.path.abspath(os.path.dirname(__file__))}/cogs"
|
||||||
@@ -40,10 +46,12 @@ def main():
|
|||||||
load_dotenv()
|
load_dotenv()
|
||||||
initialize_database()
|
initialize_database()
|
||||||
client = Client()
|
client = Client()
|
||||||
token = os.getenv("DISCORD_TOKEN") or os.getenv("TOKEN")
|
token = os.getenv("TOKEN")
|
||||||
if not token:
|
if token is not None:
|
||||||
raise SystemExit("ERROR: Discord token not found. Set DISCORD_TOKEN or TOKEN in environment.")
|
threading.Thread(target=run_web, daemon=True).start()
|
||||||
client.run(token)
|
client.run(token)
|
||||||
|
else:
|
||||||
|
print("Token is missing.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user