mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-28 07:57:04 +01:00
Added commands I think
This commit is contained in:
parent
0b0662e06c
commit
fd26f5cc99
@ -11,7 +11,7 @@ logging.getLogger('TitanBot')
|
|||||||
logging.getLogger('sqlalchemy')
|
logging.getLogger('sqlalchemy')
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix=config['command-prefix'])
|
bot = commands.Bot(command_prefix=config['command-prefix'])
|
||||||
aiosession = aiohttp.ClientSession(loop=loop)
|
aiosession = aiohttp.ClientSession(loop=bot.loop)
|
||||||
http.user_agent += ' TitanEmbeds-Bot'
|
http.user_agent += ' TitanEmbeds-Bot'
|
||||||
database = DatabaseInterface()
|
database = DatabaseInterface()
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ initFirst()
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
self.loop.run_until_complete(self.start(config["bot-token"]))
|
bot.loop.run_until_complete(self.start(config["bot-token"]))
|
||||||
except discord.errors.LoginFailure:
|
except discord.errors.LoginFailure:
|
||||||
print("Invalid bot token in config!")
|
print("Invalid bot token in config!")
|
||||||
finally:
|
finally:
|
||||||
@ -27,18 +27,18 @@ def run(self):
|
|||||||
self._cleanup()
|
self._cleanup()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Error in cleanup:", e)
|
print("Error in cleanup:", e)
|
||||||
self.loop.close()
|
bot.loop.close()
|
||||||
|
|
||||||
def _cleanup(self):
|
def _cleanup(self):
|
||||||
try:
|
try:
|
||||||
self.loop.run_until_complete(self.logout())
|
bot.loop.run_until_complete(self.logout())
|
||||||
except: # Can be ignored
|
except: # Can be ignored
|
||||||
pass
|
pass
|
||||||
pending = asyncio.Task.all_tasks()
|
pending = asyncio.Task.all_tasks()
|
||||||
gathered = asyncio.gather(*pending)
|
gathered = asyncio.gather(*pending)
|
||||||
try:
|
try:
|
||||||
gathered.cancel()
|
gathered.cancel()
|
||||||
self.loop.run_until_complete(gathered)
|
bot.loop.run_until_complete(gathered)
|
||||||
gathered.exception()
|
gathered.exception()
|
||||||
except: # Can be ignored
|
except: # Can be ignored
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user