How can I add another command to the bot to respond

Celso

Well-Known Member
Joined
Oct 1, 2017
Messages
142
Reaction score
47
Points
119
Hello, I found a script for the sinusbot just wanted to add another command for the bot to respond to it. example he has a command called !pizza only he wanted to add a command called !cake.

is it possible to do that?



This was an example ^^

JavaScript:
registerPlugin({
    name: 'PizzaTimer',
    version: '0.4',
    description: 'Do never forget your pizza in the oven again!',
    author: 'Everlike <[email protected]>',
    vars: [
        {
            name: 'msg',
            title: 'Reminder message or poke',
            type: 'string',
            placeholder: 'Your pizza is ready! Stop gaming now and get the pizza out of the oven!'
        },
    {
        name: 'morp',
        title: 'Message or Poke the client when the pizza is ready?',
        type: 'select',
        placeholder: 'message',
        options: [
        'message',
        'poke'
        ]
    },
    {
        name: 'mconfirmation',
        title: 'Confirmation message that the timer has been set, and the bot will write a message to the client.',
        type: 'string',
        placeholder: 'Alright, I´ll write you a message when your pizza is ready!'
    },
    {
        name: 'pconfirmation',
        title: 'Confirmation message that the timer has been set, and the bot will poke the client.',
        type: 'string',
        placeholder: 'Alright, I´ll poke you when your pizza is ready!'
    },
]
},  function (sinusbot, config) {
  
    var engine = require ('engine');
    var backend = require ('backend');
    var event = require ('event');
 
    var msg = config.msg || 'Your pizza is ready! Stop gaming now and get the pizza out of the oven!';
    morp = config.morp || 1;
    var mconfirmation = config.mconfirmation || 'Alright, I´ll write you a message when your pizza is ready!';
    var pconfirmation = config.pconfirmation || 'Alright, I´ll poke you when your pizza is ready!';
  
    event.on('chat', function (ev) {
        var match = ev.text.match(/^!pizza *(\d*)$/)
        if (match && morp == 0) {
            {
                ev.client.chat(mconfirmation)
            }
            setTimeout(function(){
                ev.client.chat(msg)
            }, parseInt(match[1] || 13) * 60000)
        }
        if (match && morp == 1) {
            {
                ev.client.chat(pconfirmation)
            }
            setTimeout(function() {
                ev.client.poke(msg)
            }, parseInt(match[1] || 13) * 60000)
        }
    });
});
 

Norvik

Retired Staff
Contributor
Joined
Jul 18, 2015
Messages
635
Reaction score
588
Points
157
Simply change the match variable to something else?
Code:
var match = ev.text.match(/^!cake *(\d*)$/)
 

Celso

Well-Known Member
Joined
Oct 1, 2017
Messages
142
Reaction score
47
Points
119
Simply change the match variable to something else?
Code:
var match = ev.text.match(/^!cake *(\d*)$/)

in fact wanted to add more than one command option
 

Norvik

Retired Staff
Contributor
Joined
Jul 18, 2015
Messages
635
Reaction score
588
Points
157
Well just add an else if that’s checking another variable behind the if statements.
 
Last edited:
Top