|
8 | 8 | from typing import TYPE_CHECKING |
9 | 9 |
|
10 | 10 | import discord |
11 | | - |
12 | | -# noinspection SpellCheckingInspection |
13 | 11 | from asyncstdlib.builtins import any as asyncany |
14 | 12 | from discord.ui import View |
15 | 13 |
|
@@ -275,20 +273,23 @@ async def _send_strike_user_message( |
275 | 273 |
|
276 | 274 | actual_strike_amount: int = min(3, member_strikes.strikes) |
277 | 275 |
|
278 | | - await strike_user.send( |
279 | | - "Hi, a recent incident occurred in which you may have broken one or more of " |
280 | | - f"the {self.bot.group_short_name} Discord server's rules.\n" |
281 | | - "We have increased the number of strikes associated with your account " |
282 | | - f"to {actual_strike_amount} and " |
283 | | - "the corresponding moderation action will soon be applied to you. " |
284 | | - "To find what moderation action corresponds to which strike level, " |
285 | | - "you can view " |
286 | | - f"the {self.bot.group_short_name} Discord server moderation document " |
287 | | - f"[here](<{settings.MODERATION_DOCUMENT_URL}>)\nPlease ensure you have read " |
288 | | - f"the rules in {rules_channel_mention} so that your future behaviour adheres " |
289 | | - f"to them.{includes_ban_message}\n\nA committee member will be in contact " |
290 | | - "with you shortly, to discuss this further.", |
291 | | - ) |
| 276 | + try: |
| 277 | + await strike_user.send( |
| 278 | + "Hi, a recent incident occurred in which you may have broken one or more of " |
| 279 | + f"the {self.bot.group_short_name} Discord server's rules.\n" |
| 280 | + "We have increased the number of strikes associated with your account " |
| 281 | + f"to {actual_strike_amount} and " |
| 282 | + "the corresponding moderation action will soon be applied to you. " |
| 283 | + "To find what moderation action corresponds to which strike level, " |
| 284 | + "you can view " |
| 285 | + f"the {self.bot.group_short_name} Discord server moderation document " |
| 286 | + f"[here](<{settings.MODERATION_DOCUMENT_URL}>)\nPlease ensure you have read " |
| 287 | + f"the rules in {rules_channel_mention} so that your future behaviour adheres " |
| 288 | + f"to them.{includes_ban_message}\n\nA committee member will be in contact " |
| 289 | + "with you shortly, to discuss this further.", |
| 290 | + ) |
| 291 | + except discord.Forbidden: |
| 292 | + logger.warning("Unable to send strike message to %s", strike_user) |
292 | 293 |
|
293 | 294 | async def _confirm_perform_moderation_action( |
294 | 295 | self, |
@@ -392,7 +393,6 @@ async def _confirm_increase_strike( |
392 | 393 | ) |
393 | 394 |
|
394 | 395 | if not perform_action: |
395 | | - # noinspection SpellCheckingInspection |
396 | 396 | await message_sender_component.send( |
397 | 397 | content=( |
398 | 398 | f"{confirm_strike_message}\n" |
@@ -648,7 +648,6 @@ async def _confirm_manual_add_strike( |
648 | 648 | "with number of strikes**" |
649 | 649 | ), |
650 | 650 | ) |
651 | | - # noinspection SpellCheckingInspection |
652 | 651 | await out_of_sync_ban_confirmation_message.edit( |
653 | 652 | content=( |
654 | 653 | f"Successfully banned {strike_user.mention}.\n" |
|
0 commit comments