PHP chatbot join other channel

Hi There, so I created a chatbot and joined a channel and it works fine. Bot read the message from channel and replied back. All works fine.

Now the real challenge, I created auth file where other user can authorize this bot and bot join the channel. Now I want to create a single chat screen where it display all message from all users, same script can be use for authorize users. this script should run as CLI (I dont know how to run the script in background 24x7).

I also want to know the “oauth:xxxxxxxxxxxxxx” parameter. does it will always same for all users (use the chatbot auth code), or it will be different for each user obtained from access_token. how it should work. what is the logic behind oauth.

in nutshell, my basic requirement is, chat bot and join any channel, after joning bot can read and send message to channel back. the script should run 24x7.

Please advise.

The bot logs in as user foo

To make foo join other channels, devise a way to communicate to the bot whislt it’s running

And tell the bot to JOIN #channelname

Just like any other IRC bot.

So here you may be logging in another broadcaster, to get “permission” to join their chat, but you don’t login to chat as the broadcaster, you are already connected as your bot, so you just need to be able to tell your running instance of the bot to join multiple channels without restart.

So devise a way to give instructions to the bot/script

Thank you Barry, can you tell me how I can do above. and any idea about running the PHP in background.

There are many ways to instruct a script to do something external to the script.
Pick which one works best for you

I don’t understand the question.

An invoked script will run until completion, if that script opens a socket then it should stay running as the socket being open prevents completion.

ok, Thanks for you help Barry. I will find out.

Some things to try for “external instructions”

  • Redis PubSub
  • Sending “join my chat” comamnd in the bots own Twitch chat
  • Leave commands in a flat file or database to run then
  • Maintain a list of channels to join in a database and predodically check that table and join the ones not in yet.

Theres many more operations beyond this basic/quick list.

Hi Barry, need some help. The chat bot join multiple channel. user can run the chat bot command, but when chat bot reply, it only goes to one same account. how chat bot reply to only user who runs the command. currently chat bot reply all messages to one user.
can you advise.

What do you mean? It’s unclear what you mean.

You mean threaded chat replies of just [@]ing the caller?