-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (24 loc) · 741 Bytes
/
main.py
File metadata and controls
29 lines (24 loc) · 741 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
import os
from dotenv import load_dotenv
from discord.ext import commands
current_path = os.path.dirname(os.path.abspath(__file__))
os.chdir(current_path)
load_dotenv()
if (os.path.exists("botlogs") == False):
os.mkdir("botlogs")
token = os.getenv('DISCORD_TOKEN')
# bot
bot = commands.Bot(command_prefix=';rebuild ')
print(bot.command_prefix)
bot.load_extension("cogs.RebuildCommand")
bot.load_extension("cogs.CodeforcesCommand")
bot.load_extension("cogs.BotControlCommand")
bot.load_extension("cogs.CoronaCommand")
@bot.event
async def on_ready():
print(f'{bot.user.name} has connected to Discord!')
@bot.event
async def on_command_error(ctx, error):
print(error)
await ctx.send('Error: ' + str(error))
bot.run(token)