From 9cc1004f3827bd5c3faeb202c06c6c30f0b2b5e9 Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Fri, 20 Apr 2018 21:02:28 -0800 Subject: [PATCH 1/2] Switching to asyncpg --- geeksbot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/geeksbot.py b/geeksbot.py index 6c45570..c895dd5 100644 --- a/geeksbot.py +++ b/geeksbot.py @@ -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,10 +65,10 @@ 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']}, - database={self.bot_secrets['db_con']['db_name']}, - user={self.bot_secrets['db_con']['user']}, - password={self.bot_secrets['db_con']['password']}) + 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']}) @staticmethod async def get_custom_prefix(bot_inst, message): @@ -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) From fc4529bcba7c7e143dde8e55fd2a1c8ffc26538c Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Fri, 20 Apr 2018 21:04:10 -0800 Subject: [PATCH 2/2] Ignore *.sh.swp --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cb6c93c..48594d0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ bot_secrets.json google_client_secret.json __pycache__/ logs/* +*.sh.swp \ No newline at end of file