Skip to content

Commit

Permalink
Refactored code so it pases code style check
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajiejackie committed Dec 14, 2023
1 parent 4e2c218 commit c89d01c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions uqcsbot/minecraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ async def mcwhitelist(self, interaction: discord.Interaction, username: str):
await interaction.response.send_message(response[0])

db_session.close()
@app_commands.command()

@app_commands.command()
@app_commands.describe(username="Minecraft username to unwhitelist.")
@yelling_exemptor(input_args=["username"])
async def mcunwhitelist(self, interaction: discord.Interaction, username: str):
Expand All @@ -114,7 +114,9 @@ async def mcunwhitelist(self, interaction: discord.Interaction, username: str):
)
else:
# Send the RCON command to remove the user from the whitelist
response_remove = await self.send_rcon_command(f"whitelist remove {username}")
response_remove = await self.send_rcon_command(
f"whitelist remove {username}"
)
logging.info(f"[MINECRAFT] whitelist remove {username}: {response_remove}")

# Send the RCON command to kick the player from the server
Expand All @@ -133,9 +135,11 @@ async def mcunwhitelist(self, interaction: discord.Interaction, username: str):
colour=Colour.red(), # Use red to indicate removal
)

await interaction.response.send_message(f"{response_remove[0]}\n{response_kick[0]}")
await interaction.response.send_message(
f"{response_remove[0]}\n{response_kick[0]}"
)

db_session.close()
db_session.close()

mcadmin_group = app_commands.Group(
name="mcadmin", description="Commands for managing the UQCS Minecraft server"
Expand Down Expand Up @@ -179,4 +183,4 @@ async def mcadmin(self, interaction: discord.Interaction, command: str):


async def setup(bot: UQCSBot):
await bot.add_cog(Minecraft(bot))
await bot.add_cog(Minecraft(bot))

0 comments on commit c89d01c

Please sign in to comment.