I was reading docs, and it would appear you can only run bots on certain channels specified when running the code. Meaning, you would need to manually add a channel to the array and restart the bot everytime you want a new channel. So my question is:
Is there any way to run a bot on every channel it has moderator on?
I think this is done with nightbot, but I am not sure.
You don’t have to restart a bot when you want to add a new channel, you simply use the join command and the bot will join that channel.
Most multi-channel bots have a web interface, where a user can request the bot to join their channel and the bot will just execute that join command on that users channel.
But how would it execute the command on that users channel if it’s limited to certain channels? Is there some type of channel.find kinda deal?
Also when doing this, is the channels array neccessary, since I think it would reset every time you restart the bot
I don’t understand what you’re asking.
Usually a user connects to your site, lets call them user123.
user123 clicks a button on your site asking the bot to join their channel.
your bot executes the command join #user123, and is now running on their channel.
Which is why when a user requests a bot to join their channel you update that array, so if it does need to restart it will know what channels it should be in.
Or to put it another way, you need to keep a database/table/JSON flat file/config file, something somewhere that keeps a list of the channels that your bot should be in that persists between restarts of your bot.
To answer this question directly, no, there is no API that lets you go get “channels I am a mod in” in order to go and join those channels.
Nightbot has a database table that lists all the channels, commands, users, it’s interest in, so at Restart, it just checks the table and goes from there, (it’s way more complicated, but what I wrote is valid for smaller bots)
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.