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

re-add django event handlers, allow for reading out responses in API errors in case something breaks #392

merged 11 commits into from Aug 6, 2019


Copy link

commented Aug 5, 2019

I nuked the event handlers for some reason.

Actually, I think the reason was that I wrote the new syncers cog which syncs users and roles from the server over to the API (and that made the old handlers doing that irrelevant), and for some reason thought that completely removing the error handler was a good idea. Oh well.

jchristgit added some commits Jul 28, 2019


This comment has been minimized.

Copy link

commented Aug 5, 2019

When you enter a command that does not exist, e.g. !volcyy, the bot will fall back to polling the API for the existence of a tag. However, if that tag also does not exist, the result raise_for_status is not handled (status=404, obviously):

Ignoring exception in command_error
Traceback (most recent call last):
  File "/home/sebastiaan/.local/share/virtualenvs/djangobot-Oms2CWkR/src/discord-py/discord/", line 225, in _run_event
    await coro(*args, **kwargs)
  File "/home/sebastiaan/pydis/djangobot/bot/cogs/", line 49, in on_command_error
    return await ctx.invoke(tags_get_command, tag_name=ctx.invoked_with)
  File "/home/sebastiaan/.local/share/virtualenvs/djangobot-Oms2CWkR/src/discord-py/discord/ext/commands/", line 127, in invoke
    ret = await command.callback(*arguments, **kwargs)
  File "/home/sebastiaan/pydis/djangobot/bot/cogs/", line 79, in get_command
    tag = await'bot/tags/{tag_name}')
  File "/home/sebastiaan/pydis/djangobot/bot/", line 36, in get
    self.maybe_raise_for_status(resp, raise_for_status)
  File "/home/sebastiaan/pydis/djangobot/bot/", line 32, in maybe_raise_for_status
    raise ResponseCodeError(response=response)

This doesn't happen in the current bot because the raise_for_status is a new feature of the API client.

bot/cogs/ Outdated Show resolved Hide resolved
bot/ Show resolved Hide resolved
bot/cogs/ Show resolved Hide resolved

This comment has been minimized.

Copy link
Member Author

commented Aug 5, 2019

@SebastiaanZ that's a good point, addressed in bea4e8d.

jchristgit and others added some commits Aug 5, 2019

Fix typo in bot/cogs/
Originally authored by @MarkKoz.

Co-Authored-By: Mark <>

MarkKoz approved these changes Aug 5, 2019

bot/cogs/ Show resolved Hide resolved
bot/cogs/ Outdated Show resolved Hide resolved

@MarkKoz MarkKoz merged commit a8ef752 into django Aug 6, 2019

3 checks passed

Bot-Django Build #20190805.5 succeeded
Bot-Django (Build containers) Build containers succeeded
Bot-Django (Lint & Test) Lint & Test succeeded

@MarkKoz MarkKoz deleted the django-readd-events branch Aug 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.