Skip to content

Instantly share code, notes, and snippets.

@chuckreynolds
Created October 10, 2019 21:36
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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