Skip to content

Commit

Permalink
Fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
J3y0 committed Sep 4, 2023
1 parent 555d01c commit 6623dfd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
25 changes: 19 additions & 6 deletions src/bot/custom_help_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RootPythiaHelpCommand(HelpCommand):
"""

def get_command_signature(self, command):
return '%s %s' % (command.qualified_name, command.signature)
return f"{command.qualified_name} {command.signature}"

async def send_bot_help(self, mapping):
# color attribute sets color of the border on the left
Expand All @@ -31,7 +31,9 @@ async def send_bot_help(self, mapping):
await self.get_destination().send(embed=embed)

async def send_command_help(self, command):
embed = discord.Embed(title=self.get_command_signature(command), color=discord.Color.blurple())
embed = discord.Embed(
title=self.get_command_signature(command),
color=discord.Color.blurple())

if command.help:
embed.description = command.help
Expand All @@ -41,20 +43,31 @@ async def send_command_help(self, command):
await self.get_destination().send(embed=embed)

async def send_group_help(self, group):
embed = discord.Embed(title=self.get_command_signature(group), description=group.help, color=discord.Color.blurple())
embed = discord.Embed(
title=self.get_command_signature(group),
description=group.help,
color=discord.Color.blurple())

if filtered_commands := await self.filter_commands(group.commands):
for command in filtered_commands:
embed.add_field(name=self.get_command_signature(command), value=command.help or "No Help Message Found... ")
embed.add_field(
name=self.get_command_signature(command),
value=command.help or "No Help Message Found... ")

await self.get_destination().send(embed=embed)

async def send_cog_help(self, cog):
embed = discord.Embed(title=cog.qualified_name or "No Category", description=cog.description, color=discord.Color.blurple())
embed = discord.Embed(
title=cog.qualified_name or "No Category",
description=cog.description,
color=discord.Color.blurple())

if filtered_commands := await self.filter_commands(cog.get_commands()):
for command in filtered_commands:
embed.add_field(name=self.get_command_signature(command), value=command.help or "No Help Message Found... ", inline=False)
embed.add_field(
name=self.get_command_signature(command),
value=command.help or "No Help Message Found... ",
inline=False)

await self.get_destination().send(embed=embed)

Expand Down
6 changes: 4 additions & 2 deletions src/bot/root_pythia_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def craft_intents():
# Warning: message_content is a privileged intents
# you must authorize it in the discord dev portal https://discord.com/developers/applications
# enbale message_content privilegied intent to enable commands
# More info: https://docs.pycord.dev/en/stable/api/data_classes.html#discord.Intents.message_content
# More info below:
# https://docs.pycord.dev/en/stable/api/data_classes.html#discord.Intents.message_content
intents.message_content = True

# enable guild messages related events
# More info: https://docs.pycord.dev/en/stable/api/data_classes.html#discord.Intents.guild_messages
# More info below:
# https://docs.pycord.dev/en/stable/api/data_classes.html#discord.Intents.guild_messages
intents.guild_messages = True

return intents
Expand Down
4 changes: 3 additions & 1 deletion src/bot/root_pythia_cogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ async def addusers(self, ctx, *user_ids):
Add several rootme users with [user_ids...] to the tracked users
(each id is separated by a whitespace when using the command)
"""
self.logger.info("command `addusers` received '%s' arguments: '%s'", len(user_ids), user_ids)
self.logger.info(
"command `addusers` received '%s' arguments: '%s'", len(user_ids), user_ids
)
for user_id in user_ids:
try:
user_id = int(user_id)
Expand Down

0 comments on commit 6623dfd

Please sign in to comment.