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

Handle discord.Forbidden 90001 errors by default in create_task() #177

Merged
merged 14 commits into from
Jun 10, 2023

Conversation

TizzySaurus
Copy link
Contributor

@TizzySaurus TizzySaurus commented May 6, 2023

Adds a utility for handling of discord.Forbidden 90001 errors (caused by attempting to add a reaction to a message where the message author has blocked the bot) and uses it in all created schedules.

Approved by @ChrisLovering on Discord, so there's no github issue.

@TizzySaurus TizzySaurus added s: approved An issue or PR with core developer approval a: code Pull requests which add features, fixes, or any code change t: enhancement labels May 6, 2023
@TizzySaurus TizzySaurus requested a review from ChrisLovering May 6, 2023 21:26
@netlify
Copy link

netlify bot commented May 6, 2023

Deploy Preview for bot-core ready!

Name Link
🔨 Latest commit 54d7a42
🔍 Latest deploy log https://app.netlify.com/sites/bot-core/deploys/6484c57d54ffd00007abde1f
😎 Deploy Preview https://deploy-preview-177--bot-core.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@ChrisLovering ChrisLovering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should bump the version in pyproject.toml and write a changelog entry too

pydis_core/utils/scheduling.py Outdated Show resolved Hide resolved
@wookie184
Copy link
Contributor

What's the benefit of this over adding the callback to the returned task?

@TizzySaurus
Copy link
Contributor Author

TizzySaurus commented May 6, 2023

What's the benefit of this over adding the callback to the returned task?

I'm not overly familiar with tasks, so you'd have to ask @ChrisLovering

EDIT:

The initial idea was for it to automatically add the handle_forbidden_from_block written in python-discord/bot#2580 to the task, but it seems I completely forgot about that when implementing 😅.

I think this means that the actual done_callbacks kwarg isn't required, and what is required, is the addition of handle_forbidden_from_block into bot-core, and the automatically adding it to tasks in create_task.

@TizzySaurus TizzySaurus force-pushed the add-done_callbacks-to-schedules branch from 446d1da to 763c92f Compare May 7, 2023 13:39
@TizzySaurus TizzySaurus changed the title Add done_callbacks param to create_task Handle discord.Forbidden 90001 errors by default in create_task() May 7, 2023
@TizzySaurus TizzySaurus force-pushed the add-done_callbacks-to-schedules branch 2 times, most recently from 8cbd980 to d1bd136 Compare May 7, 2023 17:16
@TizzySaurus TizzySaurus requested a review from ChrisLovering May 7, 2023 17:39
pydis_core/utils/scheduling.py Outdated Show resolved Hide resolved
@ChrisLovering ChrisLovering force-pushed the add-done_callbacks-to-schedules branch from 87270e6 to 952dc3e Compare June 10, 2023 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: code Pull requests which add features, fixes, or any code change s: approved An issue or PR with core developer approval t: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants