Fix db con
This commit is contained in:
parent
17d527adc3
commit
c54743acf4
16
bot.py
16
bot.py
@ -74,7 +74,14 @@ class Submitter(commands.Bot):
|
||||
self.infected = {}
|
||||
self.TOKEN = self.bot_secrets['token']
|
||||
del self.bot_secrets['token']
|
||||
self.db_con = asyncio.get_event_loop().run_until_complete(self.connect_db())
|
||||
|
||||
async def connect_db():
|
||||
return await asyncpg.create_pool(host=self.bot_secrets['db_con']['host'],
|
||||
database=self.bot_secrets['db_con']['db_name'],
|
||||
user=self.bot_secrets['db_con']['user'],
|
||||
password=self.bot_secrets['db_con']['password'],
|
||||
loop=self.loop)
|
||||
self.db_con = asyncio.get_event_loop().run_until_complete(connect_db())
|
||||
self.default_prefix = '!'
|
||||
self.tpe = futures.ThreadPoolExecutor()
|
||||
self.embed_color = discord.Colour.from_rgb(49, 107, 111)
|
||||
@ -87,13 +94,6 @@ class Submitter(commands.Bot):
|
||||
'o': '🇴',
|
||||
}
|
||||
|
||||
async def connect_db():
|
||||
return await asyncpg.create_pool(host=self.bot_secrets['db_con']['host'],
|
||||
database=self.bot_secrets['db_con']['db_name'],
|
||||
user=self.bot_secrets['db_con']['user'],
|
||||
password=self.bot_secrets['db_con']['password'],
|
||||
loop=self.loop)
|
||||
|
||||
@staticmethod
|
||||
async def get_custom_prefix(bot_inst, message):
|
||||
return await bot_inst.db_con.fetchval('select prefix from guild_config where guild_id = $1',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user