-
Notifications
You must be signed in to change notification settings - Fork 11
/
bot.py
36 lines (27 loc) · 1 KB
/
bot.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
33
34
35
36
import discord
import django
import os
from discord.ext import commands
os.environ.setdefault('DJANGO_ALLOW_ASYNC_UNSAFE', "true")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "longtails.settings")
django.setup()
# exec(open('bot.py').read())
from django.conf import settings
intents = discord.Intents.all()
intents.members = True
class DiscordClient(commands.Bot):
def __init__(self):
super().__init__(
command_prefix="!",
intents=intents,
application_id=settings.DISCORD_APPLICATION_ID
)
async def setup_hook(self):
# await self.load_extension(f'discord_bot.cogs.archive')
await self.load_extension(f'discord_bot.cogs.freemasons')
await self.load_extension(f'discord_bot.cogs.cooltopia')
await discord_client.tree.sync(guild=discord.Object(id=settings.DISCORD_GUILD_ID))
async def on_ready(self):
print("[Discord Client] Online.")
discord_client = DiscordClient()
discord_client.run(settings.DISCORD_TOKEN)