Skip to content

Commit d74f8c8

Browse files
committed
black?
1 parent ee7d236 commit d74f8c8

File tree

6 files changed

+317
-190
lines changed

6 files changed

+317
-190
lines changed

bot.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,9 @@ def check_account_age(self, author: discord.Member) -> bool:
549549
logger.debug("Blocked due to account age, user %s.", author.name)
550550

551551
if str(author.id) not in self.blocked_users:
552-
new_reason = _("System Message: New Account. Required to wait for {time}.").format(time=delta)
552+
new_reason = _("System Message: New Account. Required to wait for {time}.").format(
553+
time=delta
554+
)
553555
self.blocked_users[str(author.id)] = new_reason
554556

555557
return False

cogs/modmail.py

+97-54
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,18 @@ async def setup(self, ctx):
4141

4242
if ctx.guild != self.bot.modmail_guild:
4343
return await ctx.send(
44-
_("You can only setup in the Modmail guild: {guild_name}.".format(guild_name=self.bot.modmail_guild))
44+
_(
45+
"You can only setup in the Modmail guild: {guild_name}.".format(
46+
guild_name=self.bot.modmail_guild
47+
)
48+
)
4549
)
4650

4751
if self.bot.main_category is not None:
4852
logger.debug("Can't re-setup server, main_category is found.")
49-
return await ctx.send(_("{guild_name} is already set up.").format(guild_name=self.bot.modmail_guild))
53+
return await ctx.send(
54+
_("{guild_name} is already set up.").format(guild_name=self.bot.modmail_guild)
55+
)
5056

5157
if self.bot.modmail_guild is None:
5258
embed = discord.Embed(
@@ -89,21 +95,27 @@ async def setup(self, ctx):
8995

9096
embed = discord.Embed(
9197
title=_("Friendly Reminder"),
92-
description=_("You may use the `{prefix}config set log_channel_id "
93-
"<channel-id>` command to set up a custom log channel, then you can delete this default "
94-
"{log_channel} log channel.").format(prefix=self.bot.prefix, log_channel=log_channel.mention),
98+
description=_(
99+
"You may use the `{prefix}config set log_channel_id "
100+
"<channel-id>` command to set up a custom log channel, then you can delete this default "
101+
"{log_channel} log channel."
102+
).format(prefix=self.bot.prefix, log_channel=log_channel.mention),
95103
color=self.bot.main_color,
96104
)
97105

98106
embed.add_field(
99107
name=_("Thanks for using the bot!"),
100-
value=_("If you like what you see, consider giving the "
101-
"[repo a star](https://github.com/kyb3r/modmail) :star: or if you are "
102-
"feeling generous, check us out on [Patreon](https://patreon.com/kyber)!"),
108+
value=_(
109+
"If you like what you see, consider giving the "
110+
"[repo a star](https://github.com/kyb3r/modmail) :star: or if you are "
111+
"feeling generous, check us out on [Patreon](https://patreon.com/kyber)!"
112+
),
103113
)
104114

105115
embed.set_footer(
106-
text=_('Type "{prefix}help" for a complete list of commands.').format(prefix=self.bot.prefix)
116+
text=_('Type "{prefix}help" for a complete list of commands.').format(
117+
prefix=self.bot.prefix
118+
)
107119
)
108120
await log_channel.send(embed=embed)
109121

@@ -112,12 +124,14 @@ async def setup(self, ctx):
112124

113125
await self.bot.config.update()
114126
await ctx.send(
115-
_("**Successfully set up server.**\n"
116-
"Consider setting permission levels "
117-
"to give access to roles or users the ability to use Modmail.\n\n"
118-
"Type:\n- `{prefix}permissions` and `{prefix}permissions add` "
119-
"for more info on setting permissions.\n"
120-
"- `{prefix}config help` for a list of available customizations.").format(prefix=self.bot.prefix)
127+
_(
128+
"**Successfully set up server.**\n"
129+
"Consider setting permission levels "
130+
"to give access to roles or users the ability to use Modmail.\n\n"
131+
"Type:\n- `{prefix}permissions` and `{prefix}permissions add` "
132+
"for more info on setting permissions.\n"
133+
"- `{prefix}config help` for a list of available customizations."
134+
).format(prefix=self.bot.prefix)
121135
)
122136

123137
if not self.bot.config["command_permissions"] and not self.bot.config["level_permissions"]:
@@ -224,7 +238,9 @@ async def snippet_add(self, ctx, name: str.lower, *, value: commands.clean_conte
224238
embed = discord.Embed(
225239
title=_("Error"),
226240
color=self.bot.error_color,
227-
description=_("An alias with the same name already exists: `{name}`.").format(name=name),
241+
description=_("An alias with the same name already exists: `{name}`.").format(
242+
name=name
243+
),
228244
)
229245
return await ctx.send(embed=embed)
230246

@@ -323,16 +339,16 @@ async def send_scheduled_close_message(self, ctx, after, silent=False):
323339

324340
embed = discord.Embed(
325341
title=_("Scheduled close"),
326-
description=_("This thread will close {silent}in {time}.").format(silent=silent, time=human_delta),
342+
description=_("This thread will close {silent}in {time}.").format(
343+
silent=silent, time=human_delta
344+
),
327345
color=self.bot.error_color,
328346
)
329347

330348
if after.arg and not silent:
331349
embed.add_field(name=_("Message"), value=after.arg)
332350

333-
embed.set_footer(
334-
text=_("Closing will be cancelled if a thread message is sent.")
335-
)
351+
embed.set_footer(text=_("Closing will be cancelled if a thread message is sent."))
336352
embed.timestamp = after.dt
337353

338354
await ctx.send(embed=embed)
@@ -430,15 +446,18 @@ async def notify(
430446
if mention in mentions:
431447
embed = discord.Embed(
432448
color=self.bot.error_color,
433-
description=_("{mention} is already going to be mentioned.").format(mention=mention),
449+
description=_("{mention} is already going to be mentioned.").format(
450+
mention=mention
451+
),
434452
)
435453
else:
436454
mentions.append(mention)
437455
await self.bot.config.update()
438456
embed = discord.Embed(
439457
color=self.bot.main_color,
440-
description=_("{mention} will be mentioned "
441-
"on the next message received.").format(mention=mention),
458+
description=_(
459+
"{mention} will be mentioned " "on the next message received."
460+
).format(mention=mention),
442461
)
443462
return await ctx.send(embed=embed)
444463

@@ -469,7 +488,9 @@ async def unnotify(
469488
if mention not in mentions:
470489
embed = discord.Embed(
471490
color=self.bot.error_color,
472-
description=_("{mention} does not have a pending notification.").format(mention=mention),
491+
description=_("{mention} does not have a pending notification.").format(
492+
mention=mention
493+
),
473494
)
474495
else:
475496
mentions.remove(mention)
@@ -509,15 +530,18 @@ async def subscribe(
509530
if mention in mentions:
510531
embed = discord.Embed(
511532
color=self.bot.error_color,
512-
description=_("{mention} is already subscribed to this thread.").format(mention=mention),
533+
description=_("{mention} is already subscribed to this thread.").format(
534+
mention=mention
535+
),
513536
)
514537
else:
515538
mentions.append(mention)
516539
await self.bot.config.update()
517540
embed = discord.Embed(
518541
color=self.bot.main_color,
519-
description=_("{mention} will now be "
520-
"notified of all messages received.").format(mention=mention),
542+
description=_(
543+
"{mention} will now be " "notified of all messages received."
544+
).format(mention=mention),
521545
)
522546
return await ctx.send(embed=embed)
523547

@@ -548,14 +572,18 @@ async def unsubscribe(
548572
if mention not in mentions:
549573
embed = discord.Embed(
550574
color=self.bot.error_color,
551-
description=_("{mention} is not already subscribed to this thread.").format(mention=mention),
575+
description=_("{mention} is not already subscribed to this thread.").format(
576+
mention=mention
577+
),
552578
)
553579
else:
554580
mentions.remove(mention)
555581
await self.bot.config.update()
556582
embed = discord.Embed(
557583
color=self.bot.main_color,
558-
description=_("{mention} is now unsubscribed to this thread.").format(mention=mention),
584+
description=_("{mention} is now unsubscribed to this thread.").format(
585+
mention=mention
586+
),
559587
)
560588
return await ctx.send(embed=embed)
561589

@@ -740,7 +768,9 @@ async def logs_responded(self, ctx, *, user: User = None):
740768
if not embeds:
741769
embed = discord.Embed(
742770
color=self.bot.error_color,
743-
description=_("{mention} has not responded to any threads.").format(mention=getattr(user, 'mention', user.id)),
771+
description=_("{mention} has not responded to any threads.").format(
772+
mention=getattr(user, "mention", user.id)
773+
),
744774
)
745775
return await ctx.send(embed=embed)
746776

@@ -896,17 +926,17 @@ async def contact(
896926

897927
if user.bot:
898928
embed = discord.Embed(
899-
color=self.bot.error_color,
900-
description=_("Cannot start a thread with a bot."),
929+
color=self.bot.error_color, description=_("Cannot start a thread with a bot."),
901930
)
902931
return await ctx.send(embed=embed)
903932

904933
exists = await self.bot.threads.find(recipient=user)
905934
if exists:
906935
embed = discord.Embed(
907936
color=self.bot.error_color,
908-
description=_("A thread for this user already "
909-
"exists in {mention}.").format(mention=exists.channel.mention),
937+
description=_("A thread for this user already " "exists in {mention}.").format(
938+
mention=exists.channel.mention
939+
),
910940
)
911941
await ctx.channel.send(embed=embed)
912942

@@ -917,8 +947,9 @@ async def contact(
917947

918948
embed = discord.Embed(
919949
title=_("Created Thread"),
920-
description=_("Thread started by {author_mention} "
921-
"for {user_mention}.").format(author_mention=ctx.author.mention, user_mention=user.mention),
950+
description=_("Thread started by {author_mention} " "for {user_mention}.").format(
951+
author_mention=ctx.author.mention, user_mention=user.mention
952+
),
922953
color=self.bot.main_color,
923954
)
924955
await thread.wait_until_ready()
@@ -935,9 +966,7 @@ async def blocked(self, ctx):
935966
"""Retrieve a list of blocked users."""
936967

937968
embeds = [
938-
discord.Embed(
939-
title=_("Blocked Users"), color=self.bot.main_color, description=""
940-
)
969+
discord.Embed(title=_("Blocked Users"), color=self.bot.main_color, description="")
941970
]
942971

943972
users = []
@@ -1015,8 +1044,10 @@ async def blocked_whitelist(self, ctx, *, user: User = None):
10151044
reason = msg[16:].strip().rstrip(".")
10161045
embed = discord.Embed(
10171046
title="Success",
1018-
description=_("{mention} was previously blocked internally for "
1019-
'"{reason}". {mention} is now whitelisted.').format(mention=mention, reason=reason),
1047+
description=_(
1048+
"{mention} was previously blocked internally for "
1049+
'"{reason}". {mention} is now whitelisted.'
1050+
).format(mention=mention, reason=reason),
10201051
color=self.bot.main_color,
10211052
)
10221053
else:
@@ -1057,7 +1088,9 @@ async def block(self, ctx, user: Optional[User] = None, *, after: UserFriendlyTi
10571088
if str(user.id) in self.bot.blocked_whitelisted_users:
10581089
embed = discord.Embed(
10591090
title=_("Error"),
1060-
description=_("Cannot block {mention}, user is whitelisted.").format(mention=mention),
1091+
description=_("Cannot block {mention}, user is whitelisted.").format(
1092+
mention=mention
1093+
),
10611094
color=self.bot.error_color,
10621095
)
10631096
return await ctx.send(embed=embed)
@@ -1082,15 +1115,19 @@ async def block(self, ctx, user: Optional[User] = None, *, after: UserFriendlyTi
10821115
old_reason = msg.strip().rstrip(".")
10831116
embed = discord.Embed(
10841117
title=_("Success"),
1085-
description=_("{mention} was previously blocked {old_reason}.\n"
1086-
"{mention} is now blocked {reason}").format(mention=mention, old_reason=old_reason, reason=reason),
1118+
description=_(
1119+
"{mention} was previously blocked {old_reason}.\n"
1120+
"{mention} is now blocked {reason}"
1121+
).format(mention=mention, old_reason=old_reason, reason=reason),
10871122
color=self.bot.main_color,
10881123
)
10891124
else:
10901125
embed = discord.Embed(
10911126
title=_("Success"),
10921127
color=self.bot.main_color,
1093-
description=_("{mention} is now blocked {reason}").format(mention=mention, reason=reason),
1128+
description=_("{mention} is now blocked {reason}").format(
1129+
mention=mention, reason=reason
1130+
),
10941131
)
10951132
self.bot.blocked_users[str(user.id)] = reason
10961133
await self.bot.config.update()
@@ -1129,16 +1166,18 @@ async def unblock(self, ctx, *, user: User = None):
11291166
reason = msg[16:].strip().rstrip(".") or "no reason"
11301167
embed = discord.Embed(
11311168
title="Success",
1132-
description=_("{mention} was previously blocked internally "
1133-
"{reason}.\n{mention} is no longer blocked.").format(mention=mention, reason=reason),
1169+
description=_(
1170+
"{mention} was previously blocked internally "
1171+
"{reason}.\n{mention} is no longer blocked."
1172+
).format(mention=mention, reason=reason),
11341173
color=self.bot.main_color,
11351174
)
11361175
embed.set_footer(
1137-
text=_("However, if the original system block reason still applies, "
1138-
"{name} will be automatically blocked again. Use "
1139-
'"{self.bot.prefix}blocked whitelist {user.id}" to whitelist the user.').format(
1140-
name=name, prefix=self.bot.prefix, user_id=user.id
1141-
)
1176+
text=_(
1177+
"However, if the original system block reason still applies, "
1178+
"{name} will be automatically blocked again. Use "
1179+
'"{self.bot.prefix}blocked whitelist {user.id}" to whitelist the user.'
1180+
).format(name=name, prefix=self.bot.prefix, user_id=user.id)
11421181
)
11431182
else:
11441183
embed = discord.Embed(
@@ -1355,7 +1394,9 @@ async def disable_new(self, ctx):
13551394
else:
13561395
embed = discord.Embed(
13571396
title=_("Success"),
1358-
description=_("Modmail will not create **new** threads, but existing threads will now be functioning."),
1397+
description=_(
1398+
"Modmail will not create **new** threads, but existing threads will now be functioning."
1399+
),
13591400
color=self.bot.main_color,
13601401
)
13611402
self.bot.config["dm_disabled"] = 1
@@ -1404,7 +1445,9 @@ async def isenable(self, ctx):
14041445
elif self.bot.config["dm_disabled"] == 2:
14051446
embed = discord.Embed(
14061447
title=_("All DM Disabled"),
1407-
description=_("Modmail is not accepting any DM messages for new and existing threads."),
1448+
description=_(
1449+
"Modmail is not accepting any DM messages for new and existing threads."
1450+
),
14081451
color=self.bot.error_color,
14091452
)
14101453
else:

0 commit comments

Comments
 (0)