Want to call a command silently

So I’d like to call a command without chat seeing that I called the command.

Example, I have a command that is !brb and Nightbot responds. “Be Right Back All. Please stay tuned.” and another for !back “And we’re back”.

I’d like to use these commands but chat not see the “!brb” or “!back” command. Is this possible?

Hey @highbhole!

Nightbot doesn’t work with whispers, so this isn’t possible.
We can imagine a mod chat on the stream from where you’d call such commands, but Nightbot isn’t in those secondary chats yet, maybe a future development?

However, Streamlabs Chatbot can be the solution for this type of commands. Set a command for Stream Whispers starting with /me, and then whisper the bot account, and it should answer in chat.

@highbhole

Silent commands are not possible. Instead, here is a somewhat lengthy workaround.


1 - Setting up a Nightbot App

Go to your list of Nightbot applications and create a new app. You can pick any app name. You do not need a redirect URI. Click “Submit”. Click the app’s edit button on the right-hand side of the page. Take note of the client ID. Click “New Secret” to obtain a client secret. Keep your client ID and secret on hand and store them someplace safe, especially your client secret!

2 - Obtaining an Access and Refresh Token

Open the command prompt. For Windows, open the Run window by pressing Windows+R. Type cmd into the dialogue and hit enter. Once the command prompt is open, copy and paste the following cURL command into the prompt:

curl -X POST "https://api.nightbot.tv/oauth2/token" -d "client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials&scope=channel_send"

Replace CLIENT_ID with your client ID and CLIENT_SECRET with your client secret, then hit enter. You should get a response similar to the following:

{"access_token":"ACCESS_TOKEN","token_type":"bearer","expires_in":2592000,"refresh_token":"REFRESH_TOKEN","scope":"channel_send"}

Copy down the access token and refresh token. Keep these on hand and store them someplace safe as well.

3 - Sending Messages through Nightbot

You can send messages to your chat through Nightbot once you have your access and refresh tokens. When you are about to take a break from streaming, open the command prompt, then copy and paste the following cURL command into the prompt:

curl -X POST "https://api.nightbot.tv/1/channel/send" -H "Authorization: Bearer ACCESS_TOKEN" -d "message=YOUR_MESSAGE"

Replace YOUR_MESSAGE with whatever message that you want to send to your chat as Nightbot. In your case this could be a message telling your viewers to stay tuned. Hit enter. You will know when Nightbot has successfully posted the message when the command prompt returns this response:

{"status":200}

Upon returning to streaming, simply copy and paste the cURL command into the prompt again. Replace the access token, edit the message to something that will announce your return to your viewers, and hit enter. Again, you will know Nightbot has successfully posted the message when the command prompt returns a “200 status” response.

Note that Nightbot is rate limited to sending 1 message per 5 seconds. If you try to make Nightbot send messages faster than this, the command prompt returns this response:

{"status":429,"message":"Too many attempts. Try again later."}

4 - Obtaining New Tokens

Your access token will last 30 days and your refresh token will last 60 days. After your access token expires but before your refresh token expires, open the command prompt, then copy and paste the following cURL command into the prompt:

curl https://api.nightbot.tv/oauth2/token -d "client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=refresh_token&refresh_token=REFRESH_TOKEN"

Replace CLIENT_ID with your client ID, CLIENT_SECRET with your client secret, and REFRESH_TOKEN with your refresh token, then hit enter. You should get a response similar to the following:

{"access_token":"NEW_ACCESS_TOKEN","token_type":"bearer","expires_in":2592000,"refresh_token":"NEW_REFRESH_TOKEN","scope":"channel_send"}

Copy down the new access token and refresh token. Keep these on hand and store them someplace safe, just like the previous pair of tokens.

1 Like

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