Skip to content

Instantly share code, notes, and snippets.

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
What would you like to do?
snippet for TMI.js to log subscriber and/or founder badge via Alca
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