Avoid highlighting users mentioned in roster #1

Merged
khuxkm merged 1 commits from alexis/cosmicbot:no-highlight-roster into master 2018-12-03 01:02:58 +00:00
Contributor

The roster command as currently implemented highlights everyone who is mentioned in it and is also in #cosmic under the same nick as her cosmic.voyage username. This change inserts a Unicode zero-width space (#x200b) after the first character of each nick so mentioned, including the nick of the user who requests the roster, to prevent anyone being highlighted by the output.

(I don't know about anyone else, but I use a bouncer and an IRC client on my phone, as well as on various other machines. So any time I get highlighted, I hear about it! I've seen this method of preventing highlights used successfully by bots on other networks, so figured it would work out OK here too.)

Note that this change, as implemented, may break Python 2 compatibility; Python 3's Unicode-literal string syntax differs in an incompatible way. There is at least one way to do this that's compatible with both Python 2 and Python 3; if back compat is a requirement of this project, please let me know, and I'll amend this PR to preserve it.

This PR also includes a sidecar commit adding an .editorconfig file which formalizes the convention I found in use in the code.

The `roster` command as currently implemented highlights everyone who is mentioned in it and is also in #cosmic under the same nick as her cosmic.voyage username. This change inserts a Unicode zero-width space (#x200b) after the first character of each nick so mentioned, including the nick of the user who requests the roster, to prevent anyone being highlighted by the output. (I don't know about anyone else, but I use a bouncer and an IRC client on my phone, as well as on various other machines. So any time I get highlighted, I hear about it! I've seen this method of preventing highlights used successfully by bots on other networks, so figured it would work out OK here too.) Note that this change, as implemented, may break Python 2 compatibility; Python 3's Unicode-literal string syntax differs in an incompatible way. There is at least one way to do this that's compatible with both Python 2 and Python 3; if back compat is a requirement of this project, please let me know, and I'll amend this PR to preserve it. This PR also includes a sidecar commit adding an `.editorconfig` file which formalizes the convention I found in use in the code.
khuxkm closed this pull request 2018-12-03 01:02:58 +00:00
Owner

Thanks!

Thanks!
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: khuxkm/cosmicbot#1
No description provided.