Help with shoutout command?

So I’ve been working on my chat bot for about a week now and I finally got the shout out command to work but I want to make it so it’s user specific.

This is my current code

 case '!shout':
            client.say(channel, target, `${userstate['display-name']} got a shout out, Go check them out and follow to see when they go live over at twitch.tv/${userstate['display-name']}`);
            break;

but how I want it to read would be this.

 case '!shout && userstate.id':
            client.say(channel, target, `${userstate['display-name']} got a shout out, Go check them out and follow to see when they go live over at twitch.tv/${userstate['display-name']}`);
            break;

essentially making it so whoever is tagged in the command it will shout out that user. Hope this made sense and doesn’t sound stupid. Thanks for reading.

You’ll need to:

  1. Parse the command and split it at spaces
  2. Check the first argument given for a valid username
  3. Query the Twitch API for the info you want to display
  4. Respond to the command in the format you want

To call the API, you can utilize the same token you generated to connect to chat as you only need public information.

1 Like

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