Avoid highlighting users mentioned in roster
#1
Loading…
Reference in New Issue
No description provided.
Delete Branch "alexis/cosmicbot:no-highlight-roster"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.Thanks!