0
Under Review

a way to exclude/specify words from the call command

Dartis_X-UI 4 years ago updated by Support Team (Owner) 4 years ago 2

backstory:


Basically im getting revenge on dadbot lovers with even more annoying responses that are considerably more creative

For this specific issue, I would like botisimo to return a selection of pictures of hay bales every time someone says "hey" as a pun.

but if i set it to read anywhere in the message, it also registers words like THEY as HEY.


My Request

can we have a way to register only a word (such as HEY) or even exclude certain words (like THEY) - when the word specified is contained in another - while still allowing the response in global message content?


Note:

I have Idiot, More On, Moron, Oof, Pun, and more all returning a random selection of gifs, memes and one liners all called from the above words/phrases


**From Support Email:**
Hello!

Thank you for reaching out! I relayed your request to our development team and here is what they told me:

"The short answer is no, it is not possible. In order to achieve this we would need to add another variable like "$(message)" so that you could check the entire message yourself using javascript."

We're always looking for ways to add to the Bot, so I suggest submitting a feature request for this variable on the feature request forum

This is a little complicated but it can be done. You can handle the response via javascript and only return your response if your conditions are met. This example assumes the command is global matching and the name is "hey":

$(js (function() {
    // This detects if there is a word exactly matching "hey" in the message
    // in case the command was triggered by a similar word like "they"
    var exactMatch = `$(message)`.split(' ').indexOf('hey') >= 0;
    if (exactMatch) {
        // Here we return the command response because we have an exact match
        return `$(pick ...)`;
    }
    else {
        // Here we return nothing because we don't want to respond
        return '';
    }
})())

In this example, you would replace "$(pick ...)" with your command response.

Let me know if this helps.