Created
October 10, 2019 21:36
-
-
Save chuckreynolds/a61dcf35e521a247c64b91f608c526b3 to your computer and use it in GitHub Desktop.
snippet for TMI.js to log subscriber and/or founder badge via Alca https://discordapp.com/channels/325552783787032576/477487607379656716/631960904606547980
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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