-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (25 loc) · 694 Bytes
/
main.py
File metadata and controls
32 lines (25 loc) · 694 Bytes
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 os
import logging
import discord
from discord import app_commands
from commands import load_commands
BOT_TOKEN = os.environ['DISCORD_BOT_TOKEN']
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('bot.log'),
logging.StreamHandler()
]
)
logger = logging.getLogger('main')
intents = discord.Intents.default()
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
load_commands(tree)
@client.event
async def on_ready():
await tree.sync()
logger.info(f'Bot ready: {client.user}')
if __name__ == '__main__':
client.run(BOT_TOKEN)