Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vanity_url: Fix crash when editing a guild #96

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

TSRBerry
Copy link
Member

@TSRBerry TSRBerry commented Apr 14, 2024

Apparently bots are not allowed to edit vanity urls, so this PR fixes the crash when that occurs when it tries to do so.

[2024-04-12 15:04:19,484] {__init__.py:537} ERROR - Unhandled exception in internal background task 'check_changed_vanity_codes'.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
    await self.coro(*args, **kwargs)
  File "/usr/src/app/robocop_ng/cogs/vanity_url.py", line 30, in check_changed_vanity_codes
    await self.update_vanity_code(self.bot.get_guild(guild), vanity_code)
  File "/usr/src/app/robocop_ng/cogs/vanity_url.py", line 17, in update_vanity_code
    await guild.edit(
  File "/usr/local/lib/python3.11/site-packages/discord/guild.py", line 1990, in edit
    await http.change_vanity_code(self.id, vanity_code, reason=reason)
  File "/usr/local/lib/python3.11/site-packages/discord/http.py", line 739, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 20001): Bots cannot use this endpoint

I also removed this cog from the config template, since there is currently no point in running it.

However should the cog be loaded and the exception occurs, it will unload itself now.

@TSRBerry TSRBerry merged commit b2cda3f into Ryujinx:master Apr 14, 2024
2 checks passed
@TSRBerry TSRBerry deleted the fix/safe-vanity-url branch April 14, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant