Switching to asyncpg
This commit is contained in:
parent
13d4dc564c
commit
9cc1004f38
@ -57,7 +57,7 @@ class Geeksbot(commands.Bot):
|
||||
self.infected = {}
|
||||
self.TOKEN = self.bot_secrets['token']
|
||||
del self.bot_secrets['token']
|
||||
self.db_con = self.connect_db()
|
||||
self.db_con = None
|
||||
del self.bot_secrets['db_con']
|
||||
self.default_prefix = 'g~'
|
||||
self.voice_chans = {}
|
||||
@ -65,7 +65,7 @@ class Geeksbot(commands.Bot):
|
||||
self.gcs_service = build('customsearch', 'v1', developerKey=self.bot_secrets['google_search_key'])
|
||||
|
||||
async def connect_db(self):
|
||||
return await asyncpg.connect(host={self.bot_secrets['db_con']['host']},
|
||||
self.db_con = await asyncpg.connect(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']})
|
||||
@ -144,6 +144,7 @@ async def on_message(ctx):
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
bot.connect_db()
|
||||
bot.recent_msgs = {}
|
||||
for guild in bot.guilds:
|
||||
bot.recent_msgs[guild.id] = deque(maxlen=50)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user