|
|
|
@ -29,25 +29,25 @@ class TwitchChannel extends Channel {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
var nonce = this._generateRandomString(32);
|
|
|
|
|
this.chat.ws.privmsg(this.name, message, { clientNonce: nonce });
|
|
|
|
|
this.chat.getUserInfo(this.name).then((data) => {
|
|
|
|
|
this.chat.getUserInfo(this.chat.username).then((data) => {
|
|
|
|
|
this.emit('message', {
|
|
|
|
|
type: 'chat',
|
|
|
|
|
id: null,
|
|
|
|
|
id: nonce,
|
|
|
|
|
text: message,
|
|
|
|
|
spans: [ message ],
|
|
|
|
|
username: this.name,
|
|
|
|
|
displayName: data.displayName || this.name,
|
|
|
|
|
username: this.chat.username,
|
|
|
|
|
displayName: data.displayName || this.chat.username,
|
|
|
|
|
avatar: data.profileImageURL
|
|
|
|
|
});
|
|
|
|
|
resolve(true);
|
|
|
|
|
}).catch((e) => {
|
|
|
|
|
this.emit('message', {
|
|
|
|
|
type: 'chat',
|
|
|
|
|
id: null,
|
|
|
|
|
id: nonce,
|
|
|
|
|
text: message,
|
|
|
|
|
spans: [ message ],
|
|
|
|
|
username: this.name,
|
|
|
|
|
displayName: this.name,
|
|
|
|
|
username: this.chat.username,
|
|
|
|
|
displayName: this.chat.username,
|
|
|
|
|
avatar: null
|
|
|
|
|
});
|
|
|
|
|
resolve(true);
|
|
|
|
@ -180,7 +180,6 @@ class TwitchChannel extends Channel {
|
|
|
|
|
if(msg.vars.banDuration) {
|
|
|
|
|
this.emit('message', {
|
|
|
|
|
type: 'timeout',
|
|
|
|
|
client: this,
|
|
|
|
|
original: msg,
|
|
|
|
|
username: msg.text,
|
|
|
|
|
displayName: msg.text,
|
|
|
|
@ -189,14 +188,12 @@ class TwitchChannel extends Channel {
|
|
|
|
|
} else if(msg.text) {
|
|
|
|
|
this.emit('message', {
|
|
|
|
|
type: 'ban',
|
|
|
|
|
client: this,
|
|
|
|
|
original: msg,
|
|
|
|
|
username: msg.text,
|
|
|
|
|
displayName: msg.text
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.emit('clear', {
|
|
|
|
|
client: this,
|
|
|
|
|
original: msg
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|