1
0
Fork 0
mirror of synced 2024-06-15 00:54:34 +12:00

Set on_ready to look in the json file instead of MySQL

This commit is contained in:
Phxntxm 2016-07-17 12:15:39 -05:00
parent 7ad223418e
commit 8553ae3b20

11
bot.py
View file

@ -23,16 +23,11 @@ bot = commands.Bot(command_prefix=config.commandPrefix, description=config.botDe
async def on_ready():
# Change the status upon connection to the default status
await bot.change_status(discord.Game(name=config.defaultStatus, type=0))
cursor = config.getCursor()
cursor.execute('use {0}'.format(config.db_default))
cursor.execute('select channel_id from restart_server where id=1')
result = cursor.fetchone()['channel_id']
if int(result) != 0:
channel_id = config.getContent('restart_server')
if result != 0:
destination = discord.utils.find(lambda m: m.id == result, bot.get_all_channels())
await bot.send_message(destination, "I have just finished restarting!")
cursor.execute('update restart_server set channel_id=0 where id=1')
config.closeConnection()
config.saveContent('restart_server',0)
@bot.event