Repository navigation
Conversation
A fixed link is built from the URL a member posted, username included. The author label already gets a space when the username starts with `everyone` or `here`, but the username can contain the mention itself, as in `https://x.com/@everyone/status/1` or `https://x.com/x@here/status/1`: the label of the fixed link then holds it as it is, and nothing told Discord not to read it as a mention. The bot now only allows the mention of the member it replies to, and the messages it sends through a webhook (reply as the original author) none at all. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When the fixed links are sent as a replica of the original author, their author is a webhook and not the bot, so the bot handled its own messages whenever webhooks are not ignored. With a custom website whose fixed link is fixable again (its own domain, or two websites pointing at each other), each fixed link was fixed again, endlessly. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`[^.]+` accepts any character but a dot, `#` and `/` included: `https://16843009#.bilibili.com/video/BV1` was taken for a BiliBili link whose subdomain is `16843009#`, and answered with `https://16843009#.vxbilibili.com/video/BV1`, which is a link to the host `16843009` labelled as the fixer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The link was rebuilt by cutting the original URL at the first occurrence of the username, which is wrong as soon as the username also appears earlier in the URL: for `https://www.instagram.com/instagram/p/…`, the author link was `https://instagram`. The URL is now cut where the route found the username, and written as the original link is (`https`, without `www.`), so the author link of every other URL stays what it was. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The views were declared as `params` while `GenericWebsiteLink` reads `subdomains`, so the setting was saved and displayed but every Instagram link was fixed with the normal view. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`\b` only matches between a word character and another kind of character, so a keyword such as `!nofix` was not found at the start of a message or after a space: only when glued to the previous word. A keyword now matches when it stands on its own (not glued to a letter, a digit or an underscore), whatever it is made of. Nothing changes for the keywords made of word characters, such as the default `fxignore`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`message_edit` is only dispatched for the messages still in the message cache (the last 1000 received, all servers together). When a fixed link has left the cache before Discord adds its embed, the wait times out: the link is then deleted and reported as failed, although it was embedded. `raw_message_edit` is always dispatched. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
In a thread, `Send Messages in Threads` is the permission that applies, not `Send Messages`: the links posted in a thread were not fixed when the bot is only granted the former. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`safe_send_coro` reports the rate limits and the missing permissions it handles to `log.channel`. When that channel is not configured, or not found, the report itself raised (a `TypeError` for the missing setting, an `AttributeError` for the missing channel), turning a handled error into an unhandled one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nine small fixes found while reviewing the code for the three pull requests that follow (Components V2, subdomains of the custom websites, removal of the fixed links). They don't depend on them or on each other: one commit each, with the details in its message. No interface or database change.
https://x.com/@everyone/status/1is answered with[@@everyone](…): the space added after the@only covers a username that starts witheveryoneorhere. The bot now sends withallowed_mentions: only the member it replies to, and nobody through the webhook.[^.]+also accepts#and/:https://16843009#.bilibili.com/video/BV1was fixed into a link to the host16843009.https://www.instagram.com/instagram/p/…gave the author linkhttps://instagram, the URL being cut at the first occurrence of the username.paramsinstead ofsubdomains: the setting was saved, but never applied.\b, a keyword such as!nofixonly matched when glued to the previous word.message_editis only dispatched for the last 1000 cached messages: on a busy instance, a fixed link could be deleted as not embedded although it was.Send Messages in Threadsbut notSend Messages.safe_send_cororaised while reporting an error it had just handled.One thing to know before merging: the Instagram view takes effect for the first time, so the servers that already chose another view than the normal one will start getting it.
Test plan
main, then checked as fixed on this branch, with a script that simulates the Discord side (no network).mainon 672 sample URLs (every route of every generic website): all identical, so only the wrong ones change.Not verified: whether Discord really pings for an
@everyoneplaced in a link label. The fix doesn't depend on it.Written with Claude Code (Claude Fable 5.2, credited as co-author of the commits).
🤖 Generated with Claude Code