Merge branch 'development' of https://github.com/dustinpianalto/Geeksbot into development

release-1.0.0
DustyP 8 years ago
commit a38cdfb6e1

@ -57,16 +57,19 @@ class Geeksbot(commands.Bot):
self.infected = {} self.infected = {}
self.TOKEN = self.bot_secrets['token'] self.TOKEN = self.bot_secrets['token']
del self.bot_secrets['token'] del self.bot_secrets['token']
self.db_con = asyncpg.connect(f"host={self.bot_secrets['db_con']['host']}\ self.db_con = self.connect_db(self)
database={self.bot_secrets['db_con']['db_name']}\
user={self.bot_secrets['db_con']['user']}\
password={self.bot_secrets['db_con']['password']}")
del self.bot_secrets['db_con'] del self.bot_secrets['db_con']
self.default_prefix = 'g~' self.default_prefix = 'g~'
self.voice_chans = {} self.voice_chans = {}
self.spam_list = {} self.spam_list = {}
self.gcs_service = build('customsearch', 'v1', developerKey=self.bot_secrets['google_search_key']) self.gcs_service = build('customsearch', 'v1', developerKey=self.bot_secrets['google_search_key'])
async def connect_db(self):
return await asyncpg.connect(f"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 @staticmethod
async def get_custom_prefix(bot_inst, message): async def get_custom_prefix(bot_inst, message):
return await bot_inst.db_con.fetchval('select prefix from guild_config where guild_id = $1', return await bot_inst.db_con.fetchval('select prefix from guild_config where guild_id = $1',

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
until python /home/dusty/bin/geeksbot/geeksbot.py; do until python /home/dusty/bin/geeksbot_dev/geeksbot.py; do
echo "Geeksbot shutdown with error: $?. Restarting..." >&2 echo "Geeksbot shutdown with error: $?. Restarting..." >&2
sleep 1 sleep 1
done done

Loading…
Cancel
Save