-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (24 loc) · 847 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import asyncio
import os
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from dotenv import load_dotenv
def get_prefix(bot_, message):
prefix: list[str] = [";"]
return commands.when_mentioned_or(*prefix)(bot_, message)
async def load_extensions(bot_):
for filename in os.listdir("src/cogs"):
if filename.endswith(".py"):
await bot_.load_extension(f"src.cogs.{filename[:-3]}")
async def main():
intents: discord.Intents = discord.Intents.all()
bot_: Bot = commands.Bot(command_prefix=get_prefix, intents=intents)
bot_.remove_command('help')
async with bot_:
await load_extensions(bot_)
load_dotenv()
TOKEN: str = os.getenv("TOKEN")
await bot_.start(TOKEN, reconnect=True)
if __name__ == '__main__':
asyncio.run(main())