Closed HypeLevels closed 4 years ago
It's better to use the badges
property. It can tell you if the user is a broadcaster, moderator, subscriber/founder, etc.
const prefix = '!';
client.on('message', (channel, tags, message, self) => {
// If message is from this bot or is not a command
if(self || !message.startsWith(prefix)) return;
// Parse message
const args = message.slice(prefix.length).split(' ');
const command = args.shift().toLowerCase();
// Permissions
const badges = tags.badges || {};
const isBroadcaster = badges.broadcaster;
const isMod = badges.moderator;
const isModUp = isBroadcaster || isMod;
// Commands
if(command === 'clear' && isModUp) {
client.clear(channel);
}
});
Its just a question, im new to this and i made a simple clear chat command,
But EVERY USER can use it... when use the following code
Only moderators can use, the streamer cant, how do i fix that?