-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
44 lines (37 loc) · 1.24 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
37
38
39
40
41
42
43
44
import asyncio
import discord
from discord.ext import commands
import traceback
import sys
import libcurrency.libcurrency as libcurrency
try:
tkn = open("data/bot/token.txt","r").readline()
except:
print("Token file does not exist!")
open("data/bot/token.txt","w+")
print("Token file created. Add your token to it.")
exit()
botToken = tkn.strip()
bot = commands.Bot(case_insensitive=True, command_prefix='$', description='Higgsbot')
currency = libcurrency.Token()
extensions = ['cogs.money',
'cogs.general',
'cogs.containers']
if __name__ == '__main__':
for extension in extensions:
try:
bot.load_extension(extension)
except Exception as e:
print(f'Failed to load extension {extension}.', file=sys.stderr)
traceback.print_exc()
@bot.event
async def on_ready():
await currency.start(bot)
print('Logged in as {}, {}'.format(bot.user.name, bot.user.id))
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="$help for help"))
print('login success')
print('...')
@bot.listen
async def on_member_join(member):
currency.join(member)
bot.run(botToken, bot=True, reconnect=True)