Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Support 'User (mention)' style mentions used by recent client updates #171

Merged
merged 2 commits into from
Dec 20, 2019

Conversation

slicedlime
Copy link
Contributor

With a recent update, discord clients have started using <@!USER_ID> style mentions. This is documented here - I don't know when it was added, but I do know recent versions suddenly started using it, causing my bot to stop responding to commands from any user who upgraded.

This hack isn't a solution to the core problem that mentions can now have two different formats, but it at least does make commands work again in the common case. I figured since I needed to patch it up, I should at least let you know of it.

Copy link
Owner

@b1naryth1ef b1naryth1ef left a comment

Choose a reason for hiding this comment

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

I can't reproduce the client-side change in behavior, but our existing check for nickname mentions seems overly restrictive and incorrect vs. your changeset. LGTM if you can drop those two lines from get_commands_for_message

disco/bot/bot.py Outdated
@@ -312,6 +312,7 @@ def get_commands_for_message(self, require_mention, mention_rules, prefix, msg):
if member.nick:
Copy link
Owner

Choose a reason for hiding this comment

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

This line and the following line can now be deleted with your change, these where the previous check but I don't see any value in only handling a nickname-specific mention if the member has a nickname.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I pushed another commit now.

@b1naryth1ef b1naryth1ef merged commit fd63334 into b1naryth1ef:master Dec 20, 2019
elderlabs pushed a commit to elderlabs/disco that referenced this pull request Dec 29, 2019
…b1naryth1ef#171)

* Support 'User (mention)' style mentions.

* Remove conditional that should no longer be needed.

(from PR feedback)
elderlabs added a commit to elderlabs/disco that referenced this pull request Dec 29, 2019
* Adding/removing bits from the API docs that appear to be missing in disco. Also corrected the Game object as it is documented as Activity in the API docs, and contains a game object within itself. Justin also helped out in several areas where there was a bit of confusion and the bits could not be done alone. Thank you Justin. Some documentation is missing and can/will be filled in at a later date.

Co-authored-by: ThatGuyJustin <[email protected]>

* Justin proved that this is settable now, though undocumented in the API.

Co-authored-by: ThatGuyJustin <[email protected]>

* Remove GuildMember references from disco.types.message

* Patch presences typo in Guild

* Patch MessageEmbed test

* Undo overwrites changes, add missing permission 1 << 9, fix presence mess

Co-authored-by: ThatGuyJustin <[email protected]>

* Fix failing test

* Fix activity documentation to match previous changes, remove guild_id from message model

* bump requirements versions

* patch PRESENCES_REPLACE gateway events

* Changes as requested in PR by FasterSpeeding (https://github.com/FasterSpeeding)

* Add CUSTOM ActivityType

* REVERT requirements.txt changes
 - Pushed to wrong branch, oops.

* Defining a specific YAML loader (b1naryth1ef#155)

As per using one of the "'sugar' methods" mentioned in https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation#how-to-disable-the-warning

* readme: remove invite url

* Added Long Description type (b1naryth1ef#166)

In order to display long description properly at the pypi.org page we
need to specify mime type `text/markdown` for the long desccription if
readme is in markdown.

Current https://pypi.org/project/disco-py/, doesn't looks nice atm.

* Support 'User (mention)' style mentions used by recent client updates (b1naryth1ef#171)

* Support 'User (mention)' style mentions.

* Remove conditional that should no longer be needed.

(from PR feedback)

Co-authored-by: Justin <[email protected]>
Co-authored-by: One-Nub <[email protected]>
Co-authored-by: Andrei Zbikowski <[email protected]>
Co-authored-by: Oleg Butuzov <[email protected]>
Co-authored-by: slicedlime (Mikael Hedberg) <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants