mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-21 08:42:32 -05:00
Reformat with Black 22.1.0
This commit is contained in:
@@ -72,7 +72,7 @@ DisablerDictType = MutableMapping[discord.Guild, Callable[["Context"], Awaitable
|
||||
|
||||
|
||||
class RedUnhandledAPI(Exception):
|
||||
""" An exception which can be raised to signal a lack of handling specific APIs """
|
||||
"""An exception which can be raised to signal a lack of handling specific APIs"""
|
||||
|
||||
pass
|
||||
|
||||
@@ -661,7 +661,6 @@ class Command(CogCommandMixin, DPYCommand):
|
||||
|
||||
@a_command.error
|
||||
async def a_command_error_handler(self, ctx, error):
|
||||
|
||||
if isinstance(error.original, MyErrorType):
|
||||
self.log_exception(error.original)
|
||||
else:
|
||||
@@ -1131,10 +1130,10 @@ class _RuleDropper(CogCommandMixin):
|
||||
"""
|
||||
|
||||
def allow_for(self, model_id: Union[int, str], guild_id: int) -> None:
|
||||
""" This will do nothing. """
|
||||
"""This will do nothing."""
|
||||
|
||||
def deny_to(self, model_id: Union[int, str], guild_id: int) -> None:
|
||||
""" This will do nothing. """
|
||||
"""This will do nothing."""
|
||||
|
||||
def clear_rule_for(
|
||||
self, model_id: Union[int, str], guild_id: int
|
||||
@@ -1146,7 +1145,7 @@ class _RuleDropper(CogCommandMixin):
|
||||
return cur_rule, cur_rule
|
||||
|
||||
def set_default_rule(self, rule: Optional[bool], guild_id: int) -> None:
|
||||
""" This will do nothing. """
|
||||
"""This will do nothing."""
|
||||
|
||||
|
||||
class _AlwaysAvailableCommand(_AlwaysAvailableMixin, _RuleDropper, Command):
|
||||
|
||||
@@ -93,7 +93,7 @@ class Context(DPYContext):
|
||||
return await super().send(content=content, **kwargs)
|
||||
|
||||
async def send_help(self, command=None):
|
||||
""" Send the command help message. """
|
||||
"""Send the command help message."""
|
||||
# This allows people to manually use this similarly
|
||||
# to the upstream d.py version, while retaining our use.
|
||||
command = command or self.command
|
||||
@@ -360,7 +360,6 @@ if TYPE_CHECKING or os.getenv("BUILDING_DOCS", False):
|
||||
def me(self) -> discord.Member:
|
||||
...
|
||||
|
||||
|
||||
else:
|
||||
GuildContext = Context
|
||||
DMContext = Context
|
||||
|
||||
@@ -274,7 +274,6 @@ if TYPE_CHECKING:
|
||||
def get_dict_converter(*expected_keys: str, delims: Optional[List[str]] = None) -> Type[dict]:
|
||||
...
|
||||
|
||||
|
||||
else:
|
||||
|
||||
def get_dict_converter(*expected_keys: str, delims: Optional[List[str]] = None) -> Type[dict]:
|
||||
@@ -354,7 +353,6 @@ if TYPE_CHECKING:
|
||||
) -> Type[timedelta]:
|
||||
...
|
||||
|
||||
|
||||
else:
|
||||
|
||||
def get_timedelta_converter(
|
||||
|
||||
@@ -107,7 +107,7 @@ class HelpSettings:
|
||||
|
||||
@property
|
||||
def pretty(self):
|
||||
""" Returns a discord safe representation of the settings """
|
||||
"""Returns a discord safe representation of the settings"""
|
||||
|
||||
def bool_transformer(val):
|
||||
if val is False:
|
||||
@@ -306,7 +306,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
async def format_command_help(
|
||||
self, ctx: Context, obj: commands.Command, help_settings: HelpSettings
|
||||
):
|
||||
|
||||
send = help_settings.verify_exists
|
||||
if not send:
|
||||
async for __ in self.help_filter_func(
|
||||
@@ -450,7 +449,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
|
||||
@staticmethod
|
||||
def group_embed_fields(fields: List[EmbedField], max_chars=1000):
|
||||
|
||||
curr_group = []
|
||||
ret = []
|
||||
current_count = 0
|
||||
@@ -473,7 +471,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
return ret
|
||||
|
||||
async def make_and_send_embeds(self, ctx, embed_dict: dict, help_settings: HelpSettings):
|
||||
|
||||
pages = []
|
||||
|
||||
page_char_limit = help_settings.page_char_limit
|
||||
@@ -544,7 +541,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
await self.send_pages(ctx, pages, embed=True, help_settings=help_settings)
|
||||
|
||||
async def format_cog_help(self, ctx: Context, obj: commands.Cog, help_settings: HelpSettings):
|
||||
|
||||
coms = await self.get_cog_help_mapping(ctx, obj, help_settings=help_settings)
|
||||
if not (coms or help_settings.verify_exists):
|
||||
return
|
||||
@@ -613,7 +609,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
await self.send_pages(ctx, pages, embed=False, help_settings=help_settings)
|
||||
|
||||
async def format_bot_help(self, ctx: Context, help_settings: HelpSettings):
|
||||
|
||||
coms = await self.get_bot_help_mapping(ctx, help_settings=help_settings)
|
||||
if not coms:
|
||||
return
|
||||
@@ -622,7 +617,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
||||
|
||||
if await self.embed_requested(ctx):
|
||||
|
||||
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
||||
|
||||
emb["footer"]["text"] = tagline
|
||||
@@ -630,7 +624,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
emb["embed"]["title"] = f"*{description[:250]}*"
|
||||
|
||||
for cog_name, data in coms:
|
||||
|
||||
if cog_name:
|
||||
title = underline(bold(f"{cog_name}:"), escape_formatting=False)
|
||||
else:
|
||||
@@ -676,7 +669,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
yield nm, doc, max_width - width_gap
|
||||
|
||||
for cog_name, data in coms:
|
||||
|
||||
title = f"{cog_name}:" if cog_name else _("No Category:")
|
||||
to_join.append(title)
|
||||
|
||||
@@ -830,7 +822,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
and channel_permissions.read_message_history
|
||||
and help_settings.use_menus
|
||||
):
|
||||
|
||||
max_pages_in_guild = help_settings.max_pages_in_guild
|
||||
use_DMs = len(pages) > max_pages_in_guild
|
||||
destination = ctx.author if use_DMs else ctx.channel
|
||||
@@ -862,7 +853,6 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
and delete_delay > 0 # delete delay is enabled
|
||||
and channel_permissions.manage_messages # we can manage messages here
|
||||
):
|
||||
|
||||
# We need to wrap this in a task to not block after-sending-help interactions.
|
||||
# The channel has to be TextChannel as we can't bulk-delete from DMs
|
||||
async def _delete_delay_help(
|
||||
|
||||
@@ -268,7 +268,6 @@ PermStateAllowedStates = (
|
||||
|
||||
|
||||
def transition_permstate_to(prev: PermState, next_state: PermState) -> TransitionResult:
|
||||
|
||||
# Transforms here are used so that the
|
||||
# informational ALLOWED_BY_HOOK/DENIED_BY_HOOK
|
||||
# remain, while retaining the behavior desired.
|
||||
|
||||
Reference in New Issue
Block a user