diff options
| author | 2022-02-13 11:59:11 -0800 | |
|---|---|---|
| committer | 2022-02-13 11:59:11 -0800 | |
| commit | 8cb4d154087d9ed0b658719b46f25005bfa9bd25 (patch) | |
| tree | d48ad24fe619ce10d569b8578affcc4dbdbbf1c6 | |
| parent | Remove Coveralls badge from readme (diff) | |
| parent | Traceback tag: Emphasize reason for sharing traceback (#2072) (diff) | |
Merge branch 'main' into coveralls-dep
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/info/subscribe.py | 2 | ||||
| -rw-r--r-- | bot/exts/utils/reminders.py | 15 | ||||
| -rw-r--r-- | bot/resources/tags/traceback.md | 20 | 
3 files changed, 17 insertions, 20 deletions
diff --git a/bot/exts/info/subscribe.py b/bot/exts/info/subscribe.py index 1299d5d59..eff0c13b8 100644 --- a/bot/exts/info/subscribe.py +++ b/bot/exts/info/subscribe.py @@ -171,7 +171,7 @@ class Subscribe(commands.Cog):          self.assignable_roles.sort(key=operator.methodcaller("is_currently_available"), reverse=True)      @commands.cooldown(1, 10, commands.BucketType.member) -    @commands.command(name="subscribe") +    @commands.command(name="subscribe", aliases=("unsubscribe",))      @redirect_output(          destination_channel=constants.Channels.bot_commands,          bypass_roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES, diff --git a/bot/exts/utils/reminders.py b/bot/exts/utils/reminders.py index 289d00356..ad82d49c9 100644 --- a/bot/exts/utils/reminders.py +++ b/bot/exts/utils/reminders.py @@ -66,20 +66,19 @@ class Reminders(Cog):              else:                  self.schedule_reminder(reminder) -    def ensure_valid_reminder(self, reminder: dict) -> t.Tuple[bool, discord.User, discord.TextChannel]: -        """Ensure reminder author and channel can be fetched otherwise delete the reminder.""" -        user = self.bot.get_user(reminder['author']) +    def ensure_valid_reminder(self, reminder: dict) -> t.Tuple[bool, discord.TextChannel]: +        """Ensure reminder channel can be fetched otherwise delete the reminder."""          channel = self.bot.get_channel(reminder['channel_id'])          is_valid = True -        if not user or not channel: +        if not channel:              is_valid = False              log.info(                  f"Reminder {reminder['id']} invalid: " -                f"User {reminder['author']}={user}, Channel {reminder['channel_id']}={channel}." +                f"Channel {reminder['channel_id']}={channel}."              )              scheduling.create_task(self.bot.api_client.delete(f"bot/reminders/{reminder['id']}")) -        return is_valid, user, channel +        return is_valid, channel      @staticmethod      async def _send_confirmation( @@ -170,7 +169,7 @@ class Reminders(Cog):      @lock_arg(LOCK_NAMESPACE, "reminder", itemgetter("id"), raise_error=True)      async def send_reminder(self, reminder: dict, expected_time: t.Optional[time.Timestamp] = None) -> None:          """Send the reminder.""" -        is_valid, user, channel = self.ensure_valid_reminder(reminder) +        is_valid, channel = self.ensure_valid_reminder(reminder)          if not is_valid:              # No need to cancel the task too; it'll simply be done once this coroutine returns.              return @@ -206,7 +205,7 @@ class Reminders(Cog):                  f"There was an error when trying to reply to a reminder invocation message, {e}, "                  "fall back to using jump_url"              ) -            await channel.send(content=f"{user.mention} {additional_mentions}", embed=embed) +            await channel.send(content=f"<@{reminder['author']}> {additional_mentions}", embed=embed)          log.debug(f"Deleting reminder #{reminder['id']} (the user has been reminded).")          await self.bot.api_client.delete(f"bot/reminders/{reminder['id']}") diff --git a/bot/resources/tags/traceback.md b/bot/resources/tags/traceback.md index 321737aac..a4fa8aba9 100644 --- a/bot/resources/tags/traceback.md +++ b/bot/resources/tags/traceback.md @@ -1,18 +1,16 @@  Please provide the full traceback for your exception in order to help us identify your issue. +While the last line of the error message tells us what kind of error you got, +the full traceback will tell us which line, and other critical information to solve your problem. +Please avoid screenshots so we can copy and paste parts of the message.  A full traceback could look like:  ```py  Traceback (most recent call last): -    File "tiny", line 3, in -        do_something() -    File "tiny", line 2, in do_something -        a = 6 / b -ZeroDivisionError: division by zero +  File "my_file.py", line 5, in <module> +    add_three("6") +  File "my_file.py", line 2, in add_three +    a = num + 3 +TypeError: can only concatenate str (not "int") to str  ``` -The best way to read your traceback is bottom to top. -• Identify the exception raised (in this case `ZeroDivisionError`)   -• Make note of the line number (in this case `2`), and navigate there in your program.   -• Try to understand why the error occurred (in this case because `b` is `0`). - -To read more about exceptions and errors, please refer to the [PyDis Wiki](https://pythondiscord.com/pages/guides/pydis-guides/asking-good-questions/#examining-tracebacks) or the [official Python tutorial](https://docs.python.org/3.7/tutorial/errors.html). +If the traceback is long, use [our pastebin](https://paste.pythondiscord.com/).  |