-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
41 lines (28 loc) · 888 Bytes
/
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
37
38
39
40
41
import aiohttp
from discord import Game
from discord.ext import commands
from utils import Config
Config.get_token()
def get_prefix(_bot, message):
return commands.when_mentioned(_bot, message)
bot = commands.AutoShardedBot(command_prefix=get_prefix)
bot.remove_command("help")
@bot.command(name="help")
async def bot_help(ctx):
await ctx.channel.send(
f"""```
@xkcd <id>: Shows specific comic by id.
@xkcd latest: Shows latest comic.
@xkcd random: Shows random comic.
@xkcd help: Shows this message.```"""
)
@bot.event
async def on_ready():
bot.aiohttp = aiohttp.ClientSession()
print(f"{bot.user} online.")
await bot.change_presence(activity=Game(Config.get_game()))
extensions = ["cogs.xkcd", "cogs.dblstats"]
if __name__ == "__main__":
for ext in extensions:
bot.load_extension(ext)
bot.run(Config.get_token())