![]() ![]() In this example we have our "!hello" command from before, as well as one to echo messages and one to simulate rolling a six-sided die:Ĭlient.on('message', (channel, tags, message, self) =>. Replace the code in index.js with the following, which includes some basic logic for handling commands, which start with "!". We already covered saying hello, so let's check out a few more examples. Now that you can read and respond to messages sent from users in the chat, you can use your creativity to implement the logic for handling all sorts of different commands for whatever you want your bot to do. ![]() Run the code with index.js again, and try saying "!hello" in the chat to get a response:īecause I am using the same account for both it may appear as if I'm talking to myself but, one of those messages is automated and one is not. If this happens to be the case, you’d better hope your chatbot’s AI and. Without these expectations, you’re essentially handing the user a blank check and the right to ask anything while anticipating a correct answer. To avoid being rude and testing my bot in someone else's channel, I am going to connect to my own, but if you have any friends who are streaming it can be fun to connect to their streams. Your chatbot’s greeting is the ideal place to set expectations on what it can and cannot do. Youll need to get the following information in order to connect successfully to the network. I am just going to use my personal account for this. Developing Your Own Bot Download Article 1 Gather the connection details. ![]() This time you'll have to replace your_username with whatever Twitch account you're using to test this with, preferably one you created for your bot. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |