mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 18:57:59 -05:00
[V3] Update code standards (black code format pass) (#1650)
* ran black: code formatter against `redbot/` with `-l 99` * badge
This commit is contained in:
@@ -20,7 +20,7 @@ class Command(commands.Command):
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._help_override = kwargs.pop('help_override', None)
|
||||
self._help_override = kwargs.pop("help_override", None)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.translator = kwargs.pop("i18n", None)
|
||||
|
||||
@@ -40,7 +40,7 @@ class Command(commands.Command):
|
||||
translator = self.translator
|
||||
command_doc = self.callback.__doc__
|
||||
if command_doc is None:
|
||||
return ''
|
||||
return ""
|
||||
return inspect.cleandoc(translator(command_doc))
|
||||
|
||||
@help.setter
|
||||
@@ -60,6 +60,7 @@ class Group(Command, commands.Group):
|
||||
|
||||
# decorators
|
||||
|
||||
|
||||
def command(name=None, cls=Command, **attrs):
|
||||
"""A decorator which transforms an async function into a `Command`.
|
||||
|
||||
|
||||
@@ -59,10 +59,9 @@ class Context(commands.Context):
|
||||
else:
|
||||
return True
|
||||
|
||||
async def send_interactive(self,
|
||||
messages: Iterable[str],
|
||||
box_lang: str=None,
|
||||
timeout: int=15) -> List[discord.Message]:
|
||||
async def send_interactive(
|
||||
self, messages: Iterable[str], box_lang: str = None, timeout: int = 15
|
||||
) -> List[discord.Message]:
|
||||
"""Send multiple messages interactively.
|
||||
|
||||
The user will be prompted for whether or not they would like to view
|
||||
@@ -84,9 +83,9 @@ class Context(commands.Context):
|
||||
messages = tuple(messages)
|
||||
ret = []
|
||||
|
||||
more_check = lambda m: (m.author == self.author and
|
||||
m.channel == self.channel and
|
||||
m.content.lower() == "more")
|
||||
more_check = lambda m: (
|
||||
m.author == self.author and m.channel == self.channel and m.content.lower() == "more"
|
||||
)
|
||||
|
||||
for idx, page in enumerate(messages, 1):
|
||||
if box_lang is None:
|
||||
@@ -105,10 +104,10 @@ class Context(commands.Context):
|
||||
query = await self.send(
|
||||
"There {} still {} message{} remaining. "
|
||||
"Type `more` to continue."
|
||||
"".format(is_are, n_remaining, plural))
|
||||
"".format(is_are, n_remaining, plural)
|
||||
)
|
||||
try:
|
||||
resp = await self.bot.wait_for(
|
||||
'message', check=more_check, timeout=timeout)
|
||||
resp = await self.bot.wait_for("message", check=more_check, timeout=timeout)
|
||||
except asyncio.TimeoutError:
|
||||
await query.delete()
|
||||
break
|
||||
@@ -134,9 +133,7 @@ class Context(commands.Context):
|
||||
"""
|
||||
if self.guild and not self.channel.permissions_for(self.guild.me).embed_links:
|
||||
return False
|
||||
return await self.bot.embed_requested(
|
||||
self.channel, self.author, command=self.command
|
||||
)
|
||||
return await self.bot.embed_requested(self.channel, self.author, command=self.command)
|
||||
|
||||
async def maybe_send_embed(self, message: str) -> discord.Message:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user