-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
40 lines (32 loc) · 1.1 KB
/
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
33
34
35
36
37
38
39
40
import discord
from discord.ext import commands
import os
import logging
from cogs.general.listener import Listener
# get token, application ID from env
TOKEN = os.environ.get("BOT_TOKEN")
ID = os.environ.get("BOT_ID")
# set logging
handler = logging.FileHandler(filename="discord.log", encoding="utf-8", mode="w")
class MyBot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
activity = discord.Game(name="Blue Archive")
super().__init__(
command_prefix="?",
activity=activity,
description="흰둥이",
intents=intents,
application_id=ID,
)
self.initial_extensions = ["cogs.general.menu", "cogs.general.listener"]
async def setup_hook(self):
for ext in self.initial_extensions:
await self.load_extension(ext)
await self.tree.sync()
async def on_command_error(self, ctx, error):
# await ctx.reply(error, ephemeral=True)
return
bot = MyBot()
bot.run(TOKEN, log_handler=None, log_level=logging.DEBUG)