Fixed bug in _allowed_channels
This commit is contained in:
parent
778e9890ba
commit
687c62dce7
@ -158,21 +158,16 @@ class Admin:
|
|||||||
await ctx.send(f'{channel} is not a valid text channel in this guild.')
|
await ctx.send(f'{channel} is not a valid text channel in this guild.')
|
||||||
else:
|
else:
|
||||||
admin_log.info('Chan found')
|
admin_log.info('Chan found')
|
||||||
if await self.bot.db_con.fetchval('select allowed_channels from guild_config '
|
allowed_channels = await self.bot.db_con.fetchval('select allowed_channels from guild_config '
|
||||||
'where guild_id = $1', ctx.guild.id):
|
'where guild_id = $1', ctx.guild.id):
|
||||||
if chnl.id in json.loads(await self.bot.db_con.fetchval('select allowed_channels '
|
if allowed_channels
|
||||||
'from guild_config '
|
allowed_channels = json.loads(allowed_channels)
|
||||||
'where guild_id = $1',
|
if chnl.id in allowed_channels:
|
||||||
ctx.guild.id)):
|
|
||||||
admin_log.info('Chan found in config')
|
admin_log.info('Chan found in config')
|
||||||
await ctx.send(f'{channel} is already in the list of allowed channels. Skipping...')
|
await ctx.send(f'{channel} is already in the list of allowed channels. Skipping...')
|
||||||
else:
|
else:
|
||||||
admin_log.info('Chan not found in config')
|
admin_log.info('Chan not found in config')
|
||||||
allowed_channels = (json.loads(
|
allowed_channels = allowed_channels.append(chnl.id)
|
||||||
await self.bot.db_con.fetchval('select allowed_channels '
|
|
||||||
'from guild_config '
|
|
||||||
'where guild_id = $1',
|
|
||||||
ctx.guild.id))).append(chnl.id)
|
|
||||||
await self.bot.db_con.execute('update guild_config set allowed_channels = $2 '
|
await self.bot.db_con.execute('update guild_config set allowed_channels = $2 '
|
||||||
'where guild_id = $1', ctx.guild.id,
|
'where guild_id = $1', ctx.guild.id,
|
||||||
json.dumps(allowed_channels))
|
json.dumps(allowed_channels))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user