diff options
author | 2024-03-24 14:59:10 +0800 | |
---|---|---|
committer | 2024-03-24 15:16:10 +0800 | |
commit | e7780bd8890aa16f2f701e387442f5c45d0bffc1 (patch) | |
tree | 5beeadda2a04d62648a112a28a83e91ecb64c77f /tests | |
parent | Merge pull request #2966 from python-discord/dependabot/pip/ruff-0.3.4 (diff) |
Reminders: Add a button for others to opt-in to a ping
This is the initial implementation - it's currently _far_ from perfect
and is very susceptible to errors.
Notable features beyond the basic requirements:
- Fails safely when max mentions reached (we're limited by the
2000-character limit when sending the reminder with the pings), and
disables the button.
- Adds an additional embed to the initial confirmation message to show
who clicked on the notify button.
- Edits the additional embed and disables the button when the reminder
is sent.
In many ways, this implementation is quite bad:
- Uses an async callback to delegate the task of PATCH-ing the API to
edit mentions to the `new_reminders` method.
- Edits to the opt-in list embed relies on the fact that the reminder is
not edited (using !remind edit) before someone clicks on the button. A
trivial way to fix this would be to add another field to the site
schema to store the `notification_view` in some way.
- The button is neither disabled nor any edits to the embed made when
the reminder is deleted before someone clicks on the button.
- String splitting is used which relies on the exact format of the embed
message when editing the embed to disable the button. We have to
reminder to update this piece of code when adjusting its format in the
future.
The UX can also be improved. Currently, I can't think of a way to
concisely phrase the button embed message so that it is clear that the
button is for people _other than_ the reminder author.
Notes:
- Max reminder mentions:
- Mentions are pinged directly in a discord message when the reminder
is sent. This means we're limited by the 2000-char limit. If we take
each User ID snowflake to be 18-characters, and considering each
mention to be formated as "<@ID> " (with extra space), it results in
about 90 mentions max. I've set the constant to 80 just in case.
- This is not an issue when the mentions are added in through other
means than the button we're adding in this commit, because the user
has to use @-mentions when sending the `!remind edit` command, which
is already under the discord's character limit.
- Log messages are added when something unexpected occurs within the
code. Hopefully this is unlikely to happen after the implementation
issues listed above are solved.
- The opt-in list in the second embed is separate from mentions added in
the original reminder creation, or any further edits, because mentions
are added by the to-be-mentioned-user, rather than by the reminder
author in this way. (Even though they are stored the same way.)
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions