Skip to content

Commit

Permalink
Merge pull request #59 from BlueAtomic/fix-guild-logs
Browse files Browse the repository at this point in the history
Fix guild logs
  • Loading branch information
JoshuaSlui authored Aug 15, 2023
2 parents 58dfb94 + f5215b7 commit 493f135
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cogs/internallogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, bot: Bot):

@commands.Cog.listener()
async def on_guild_join(self, guild: Guild):
result = (await selector("SELECT * FROM blacklist WHERE guild_id = %s", [guild.id]))[1]
result = await selector("SELECT * FROM blacklist WHERE guild_id = %s", [guild.id])

if result:
await guild.leave()
Expand All @@ -23,7 +23,7 @@ async def on_guild_join(self, guild: Guild):
embed.add_field(name="Guild member count", value=guild.member_count, inline=True)
embed.add_field(name="Current server count", value=len(self.bot.guilds), inline=True)
if result:
embed.description = f'**THIS GUILD IS BLACKLISTED**\n**Reason:** {result}'
embed.description = f'**THIS GUILD IS BLACKLISTED**\n**Reason:** {result[1]}'
if guild.icon is not None:
embed.set_thumbnail(url=guild.icon)
async with aiohttp.ClientSession() as client_session:
Expand All @@ -32,14 +32,14 @@ async def on_guild_join(self, guild: Guild):

@commands.Cog.listener()
async def on_guild_remove(self, guild: Guild):
result = (await selector("SELECT * FROM blacklist WHERE guild_id = %s", [guild.id]))[1]
result = await selector("SELECT * FROM blacklist WHERE guild_id = %s", [guild.id])
embed = Embed(title="Left a guild!", color=Colors.red)
embed.add_field(name="Name", value=guild.name, inline=True)
embed.add_field(name="ID", value=guild.id, inline=True)
embed.add_field(name="Guild member count", value=guild.member_count, inline=True)
embed.add_field(name="Current server count", value=len(self.bot.guilds), inline=True)
if result:
embed.description = f'**THIS GUILD IS BLACKLISTED**\n**Reason:** {result}'
embed.description = f'**THIS GUILD IS BLACKLISTED**\n**Reason:** {result[1]}'
if guild.icon is not None:
embed.set_thumbnail(url=guild.icon)
async with aiohttp.ClientSession() as client_session:
Expand Down
2 changes: 1 addition & 1 deletion utilities/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def selector(query: str, variables: list):
try:
result = database.fetchall()[0]
except IndexError:
return [False]
return ()
database.close()
cursor.close()
return result
Expand Down

0 comments on commit 493f135

Please sign in to comment.