How to make a command with text for the first person who uses it per stream

Asked Nov 13, 2022·10 replies·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

SO, there is a problem with channel points redemptions not working right away at the start of the stream. So does anyone know if there is a way to add a nightbot way to make a first command?

Thanks!

10 replies

Hey @Rapid Orangutan!

I don't understand what you're looking for, can you try to rephrase your request? The more specific you are, the better.

I'm a moderator in a stream and the streamer wants a way to make a command that works like a normal first redemption that you can redeem for 1 point.

so for example, if you type "!first" in chat and you are the first person to use the command that stream, you will claim a first redemption.

If you know anyway to do this please let me know!

Thanks!

Is the command to WIN something ? If so then the giveaways built into NB can say who got the right word first. (Keyword Giveaway)

Thank you for the explanation, I now understand.

First of all, I should clarify that Twitch doesn't offer an API endpoint for Channel Points, therefore Nightbot can't manage them in any way. I don't know if that's what you were after, clarifying just in case.

Now, what I can offer you is to add their names to a list, which can then be consulted, we can also have a congratulation message if an user is indeed the first one to use it, and a message that tells everyone who was first once they use the command later, would that work for you?

Yes! that would be perfect!

I do need to ask if the command resets every stream as if it did not it would be harder to use. If it does reset every stream then its perfect!

Thanks for the help!

Rapid Orangutan said:
I do need to ask if the command resets every stream as if it did not it would be harder to use.

Yes, that was already planned, the whole thing will be automated, don't worry. 😉

We'll use the Quote API, get your tokens by following the Manual Installation link.
Refer to the following to identify your PUBLIC_TOKEN and PRIVATE_TOKEN:

$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=$(querystring))

Copy them and store them somewhere safe, never share your PRIVATE_TOKEN, anyone could then manage your list, that's why the code I'll write won't contain command calls to add the new commands through the chat, add the new commands through the dashboard.

The command will be split in two parts, the second half being the alias of the first one:

  • Command: !first

Message:

js
$(eval const l = '$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-1&no_id=1)'.split(' | '); const s = '$(twitch $(channel) "{{uptimeAt}}")'; const u = '$(user)'; !l[0].includes(s) ? `PRIVATE_TOKEN&data=${encodeURI(s + ' | ' + u)}` : l[1].includes(u) ? `Yes ${u}, you were first today!` : `Sorry ${u}, you were not first today, ${l[1]} was!`;)

Alias: _first

  • Command: _first

Message:

js
js
$(eval const q = decodeURI('$(query)'); const a = '$(urlfetch https://twitch.center/customapi/addquote?token=$(query))'; !q.includes('PRIVATE_TOKEN') ? q : a.includes('Successfully added') ? `Congratulations ${q.split(' | ')[1]}, you are first!` : 'There was an error, try again later';)

All you have to do now is to replace the PUBLIC_TOKEN (1) and PRIVATE_TOKEN (2) fields, and add the commands to your instance of Nightbot through the dashboard.

Thanks for the help!

The only problem I'm having is that I am a moderator for the channel so I cant add things through the dashboard! Is is possible for you to make something a could copy and paste to send to the streamer? If so that would make things a whole lot easier!

You have three options:

  • have the streamer add you as a manager (you need to have a Nightbot account) so you can manage their commands through the dashboard;
  • follow the guide I provided: generate the TOKENS (it doesn't matter if it's the streamer or not), and then send them the edited commands' code with an explanation of how to set it up;
  • share this topic with them, they should be able to follow along, and request help if they need.

Ok!

That's all I need!

Thanks for all your help Emily :)

Didn't find your answer? The community is on Discord.

Ask on Discord