Skip to content

Commit

Permalink
Removed unused query variable and refactored its related code
Browse files Browse the repository at this point in the history
  • Loading branch information
fattyhope committed Dec 15, 2023
1 parent 25b457b commit 8a4d1dc
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions uqcsbot/minecraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ async def mcwhitelist(self, interaction: discord.Interaction, username: str):
async def mcunwhitelist(self, interaction: discord.Interaction, username: str):
"""Removes a username from the whitelist for the UQCS server."""
db_session = self.bot.create_db_session()
query = db_session.query(MCWhitelist).filter(
MCWhitelist.discord_id == interaction.user.id
)
is_user_admin = (
isinstance(interaction.user, Member)
and interaction.user.guild_permissions.manage_guild
Expand All @@ -126,11 +123,7 @@ async def mcunwhitelist(self, interaction: discord.Interaction, username: str):

# If the responses indicate successful removal, remove from the database item
if "Removed" in response_remove[0]:
query = (
db_session.query(MCWhitelist)
.filter(MCWhitelist.mc_username == username)
.delete()
)
db_session.query(MCWhitelist).filter(MCWhitelist.mc_username == username).delete()
db_session.commit()

await self.bot.admin_alert(
Expand Down

0 comments on commit 8a4d1dc

Please sign in to comment.