Can Nightbot trigger custom command by API?

While I can send a Nightbot message to chat by API, it doesn’t (ever) recognize it’s own custom commands. Is there any way, other than bouncing messages between bots, to have Nightbot become self-responsive via API?

Nightbot doesn’t activate it’s own commands if it sends a message that starts with that command. What use case would you have for this where the api itself couldn’t do the extra work?

the api itself couldn’t do the extra work

I have an authorized application that is scraping a webpage with javascript, to determine when a value is reached and sending a message (custom command) to the channel.

I have a custom command on a bot, which keeps a count (like a swear jar), but I can’t trigger it via my external app I built and is authorized via the scope: commands channel_send

If I wanted to use the WebToSpeechAPI on chrome to do something similar (for an actual swearjar simulator), I also would need to be able to send a custom command via msg. I can think of more use cases, I’m sure.

If you need the count of a specific command that can be gotten through the api: https://api-docs.nightbot.tv/#get-custom-command-by-id

If that count needs to be modified that can also be done through the api, without trying to make nightbot call itself: https://api-docs.nightbot.tv/#edit-custom-command-by-id

I don’t understand how this would need to post a message in chat via nightbot to help this scenario at all. Could you explain?

Having nightbot able to call commands through it’s own messages could lead to abuse (which has been done in the past, where someone has nightbot responding to its own commands constantly repeating in chat), so there should be ways to do what you want outside of having nightbot call its own commands.

Oh i see, i misinterpreted your initial post. You cannot trigger a custom command through the api. As the api docs for commands show. The links i provided you with are ways you can do what you want without needing that and without trying to make nightbot call itself.

I understand, editing the count is a good idea, but I worry about race conditions between users and API now - user calls command and API calls command. One may block the other or overwrite.

However, this is all relatively baroque compared to the authentication process.
I’m really surprised I can’t make a calendar app on https://mydomain.com/calendar
that calls nightbot on events and has it celebrate/scrim by executing custom commands.

!commands add !celebrate Jack9 is celebrating!
!commands add !inmatch Jack9 is in a scrimmage (competition)

I believe you could instead make the user call your API instead using https://docs.nightbot.tv/commands/variables/urlfetch This way you would avoid a race.

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