mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-27 09:40:09 +02:00
Support twitch.tv nick capitalization (sent in the display-name tag)
Twitch uses this tag to send capitalization for nicknames, set by users in Settings, and always sends the regular nick field lowercase. A large portion of Twitch users set it, and using the wrong capitalization to address a Twitch user looks out of place. This sets a user's nick to the correct capitalization, when received. And therefore also helps with autocompletion.
This commit is contained in:
parent
e9f0313892
commit
692a21e279
|
@ -105,6 +105,23 @@ module.exports = function (irc, network) {
|
|||
}
|
||||
}
|
||||
|
||||
if (irc.network.cap.isEnabled("twitch.tv/tags") && data.tags) {
|
||||
// Twitch uses display-name to confer capitalization that users have set
|
||||
// for their nicknames in Settings, and otherwise sends them lowercase.
|
||||
const displayName = data.tags["display-name"];
|
||||
|
||||
// Promote the correct capitalization for the user, when present
|
||||
if (displayName && displayName.toLowerCase() === data.nick) {
|
||||
if (from.nick !== displayName) {
|
||||
from.nick = displayName;
|
||||
|
||||
client.emit("users", {
|
||||
chan: chan.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// msg is constructed down here because `from` is being copied in the constructor
|
||||
const msg = new Msg({
|
||||
type: data.type,
|
||||
|
|
Loading…
Reference in a new issue