Reputation: 24
I am trying to make a twitch bot using javascript and tmi.js and I need to make a command that can capture the data after someone says the word !add, I don't know what module to use in this case, any ideas?
client.on("chat", (channel, user, message, self) => {
if (message == "!add")
fs.appendFile('test.txt', game + ", ", function (err) {
if (err) throw err
client.say (Titles,"added!", 'utf8',);
Upvotes: 1
Views: 745
Reputation: 168
Instead of checking if the message is a command, you can check if the message contains a command, strip the command away and keep the command arguments.
if (message.includes("!add")) {
let arguments= message.replace("!add", "");
//check what arguments contain and do what you want
}
Upvotes: 1