|
|
|
@ -62,14 +62,14 @@ class Geeksbot(commands.Bot):
|
|
|
|
user={self.bot_secrets['db_con']['user']}\
|
|
|
|
user={self.bot_secrets['db_con']['user']}\
|
|
|
|
password={self.bot_secrets['db_con']['password']}")
|
|
|
|
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'])
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
async def get_custom_prefix(bot_inst, message):
|
|
|
|
async def get_custom_prefix(bot_inst, message):
|
|
|
|
return bot_inst.db_con.fetch('select prefix from guild_config where guild_id = $1',
|
|
|
|
return bot_inst.db_con.fetchval('select prefix from guild_config where guild_id = $1',
|
|
|
|
message.guild.id) or bot_inst.default_prefix
|
|
|
|
message.guild.id) or bot_inst.default_prefix
|
|
|
|
|
|
|
|
|
|
|
|
async def load_ext(self, ctx, mod=None):
|
|
|
|
async def load_ext(self, ctx, mod=None):
|
|
|
|
@ -122,14 +122,14 @@ async def unload(ctx, mod):
|
|
|
|
async def on_message(ctx):
|
|
|
|
async def on_message(ctx):
|
|
|
|
if not ctx.author.bot:
|
|
|
|
if not ctx.author.bot:
|
|
|
|
if ctx.guild:
|
|
|
|
if ctx.guild:
|
|
|
|
if int(bot.db_con.fetchrow("select channel_lockdown from guild_config where guild_id = $1",
|
|
|
|
if int(bot.db_con.fetchval("select channel_lockdown from guild_config where guild_id = $1",
|
|
|
|
ctx.guild.id)):
|
|
|
|
ctx.guild.id)):
|
|
|
|
if ctx.channel.id in json.loads(bot.db_con.fetchrow("select allowed_channels from guild_config "
|
|
|
|
if ctx.channel.id in json.loads(bot.db_con.fetchval("select allowed_channels from guild_config "
|
|
|
|
"where guild_id = $1",
|
|
|
|
"where guild_id = $1",
|
|
|
|
ctx.guild.id)):
|
|
|
|
ctx.guild.id)):
|
|
|
|
await bot.process_commands(ctx)
|
|
|
|
await bot.process_commands(ctx)
|
|
|
|
elif ctx.channel.id == 418452585683484680:
|
|
|
|
elif ctx.channel.id == 418452585683484680:
|
|
|
|
prefix = bot.db_con.fetchrow('select prefix from guild_config where guild_id = $1', ctx.guild.id)
|
|
|
|
prefix = bot.db_con.fetchval('select prefix from guild_config where guild_id = $1', ctx.guild.id)
|
|
|
|
prefix = prefix[0] if prefix else bot.default_prefix
|
|
|
|
prefix = prefix[0] if prefix else bot.default_prefix
|
|
|
|
ctx.content = f'{prefix}{ctx.content}'
|
|
|
|
ctx.content = f'{prefix}{ctx.content}'
|
|
|
|
await bot.process_commands(ctx)
|
|
|
|
await bot.process_commands(ctx)
|
|
|
|
@ -149,12 +149,12 @@ async def on_ready():
|
|
|
|
for load_item in load_list:
|
|
|
|
for load_item in load_list:
|
|
|
|
await bot.load_ext(None, f'{load_item}')
|
|
|
|
await bot.load_ext(None, f'{load_item}')
|
|
|
|
logging.info('Extension Loaded: {0}'.format(load_item))
|
|
|
|
logging.info('Extension Loaded: {0}'.format(load_item))
|
|
|
|
logging.info('Done loading, Geeksbot is active.')
|
|
|
|
|
|
|
|
with open(f'{config_dir}reboot', 'r') as f:
|
|
|
|
with open(f'{config_dir}reboot', 'r') as f:
|
|
|
|
reboot = f.readlines()
|
|
|
|
reboot = f.readlines()
|
|
|
|
if int(reboot[0]) == 1:
|
|
|
|
if int(reboot[0]) == 1:
|
|
|
|
await bot.get_channel(int(reboot[1])).send('Restart Finished.')
|
|
|
|
await bot.get_channel(int(reboot[1])).send('Restart Finished.')
|
|
|
|
with open(f'{config_dir}reboot', 'w') as f:
|
|
|
|
with open(f'{config_dir}reboot', 'w') as f:
|
|
|
|
f.write(f'0')
|
|
|
|
f.write(f'0')
|
|
|
|
|
|
|
|
logging.info('Done loading, Geeksbot is active.')
|
|
|
|
|
|
|
|
|
|
|
|
bot.run(bot.TOKEN)
|
|
|
|
bot.run(bot.TOKEN)
|
|
|
|
|