Get data about a command

I’d like to be able to get information about a/the command. Specifically I’m looking to get the userlevel. I see the $(UserLevel) variable but that’s for the user, not the command.
As far as I can tell we have no way of giving the user feedback that they’re not allowed to execute a command, rather than just being ignored by Nightbot and not getting any useful feedback.

1 Like

Hey @houdini111!

You can do what you’re looking for by using $(userlevel), here’s an example:
→ The command’s userlevel is set to Everyone, but you want to limit the output to VIP and above, while displaying an error to the other chatters who don’t have the userlevel required:

!addcom !commandName $(eval u=['owner', 'moderator', 'twitch_vip', 'subscriber', 'everyone']; u.indexOf('$(userlevel)') > 2 ? 'You can't use this command, sorry $(user)' : 'You're cool enough to use this command!')

Indexes in arrays start at 0, so twitch_vip is at index 2, update the index number according to your needs.
Update the two responses to your liking.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.