Closed matt332 closed 6 years ago
Personally my bot uses this with 100% accuracy:
if(user.mod || user['user-type'] === 'mod') {
// Something mod only
}
I am trying to make a shout out command for a mod only and that ^ didnt seem to work can i please have some help help
Here is an example of my code client.on("chat", function(channel, user, message, self){ if(user.mod || user['user-type'] === 'mod') { if(message.startsWith("!so")){ var input = message.split(' ')[1]; client.say("matty70988", "Go check out the wonderful " + input + " over at htpp://twitch.tv/" + input); }; }; });
You may also want to check that the broadcaster can use it. They are not considered a moderator in the chat.
let isMod = user.mod || user['user-type'] === 'mod';
let isBroadcaster = channel.slice(1) === user.username;
let isModUp = isMod || isBroadcaster;
Then use isModUp for command checking:
if(isModUp) {
// Something for moderators or higher
}
oh
@NitchgamingStudios WIthin a message event handler.
Don't use this issue as a general JavaScript programming forum. You can join the Twitch API Discord Server and chat in the #general-javascript
channel or #tmi
channel.
I would have thought that it would be as simple as saying ''if(user.mod),, around the command response but apparently not, i have read through the doccumentation and it doesnt say how to create it can somebody help