Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
snippet for TMI.js to log subscriber and/or founder badge via Alca https://discordapp.com/channels/325552783787032576/477487607379656716/631960904606547980
client.on('message', (channel, tags, message, self) => {
if(self) return;
const { badges, 'badge-info': badgeInfo } = tags;
let isSubscriber = false;
let monthsSubbed = -1;
if(badges) {
isSubscriber = badges.subscriber || badges.founder;
if(isSubscriber) {
monthsSubbed = badgeInfo.subscriber || badgeInfo.founder;
}
}
if(isSubscriber) {
console.log(`${tags.username} is a subscriber for ${monthsSubbed} month(s).`);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.