tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 214 forks source link

Message deleted event not working reliably #362

Closed xenorio closed 5 years ago

xenorio commented 5 years ago

Actual behaviour: Sometimes there is no messagedeleted event fired when a message gets deleted by a moderator

Expected behaviour: Every deletion of a message should fire the event

Server configuration

AlcaDesign commented 5 years ago

I can't necessarily identify any situation in which tmi.js receiving a "CLEARMSG" command would not result in the "messagedeleted" event being fired. If Twitch doesn't send the event, there's nothing tmi.js can do.

AlcaDesign commented 5 years ago

Perhaps if the message is not being sent to the client as part of the "CLEARMSG". If you could collect raw IRC message instances of that happening I'd be interested.


client.connect().then(() => {
    client.ws.on('message', message => {
        const isClearMsg = message.includes(':tmi.twitch.tv CLEARMSG ');
        if(!isClearMsg) {
            return;
        }
        const isEmptyClearMsg = / :tmi\.twitch\.tv CLEARMSG #\w+ :\s*$/.test(message);
        if(isEmptyClearMsg) {
            console.log('Empty clear msg example:');
            console.log(message);
        }
    });
});
xenorio commented 5 years ago

I found out that i actually had some kind of bug on the website showing messages as deleted when they're not.