Hey I’m sorry for the dumb question I’m new to all this stuff. How would you add a second command to the bot?
Hi! You can copy the code block with .hears. There is an example here:
Hope that’s helpful, lemme know if you have any other questions!
@mmcewen How do I let the bot use ambient?
@Swiftammer422 have you tried pancake. Very forward.
What’s pancake? I need this to be 20 characters to post so I’m adding extra words
In your .hears method, the second parameter allows you to set the context of when a handler is executed.
ie:
discordBot.hears('noodles', 'ambient', (bot, message) => bot.reply('pho noodles!'));
If you want your hears to support across different contexts, just use an array like such: [‘ambient’, ‘direct_message’]
So whenever the bot hears noodles in any message within a thread it’s in, it will respond with pho noodles!
too bad people dont know how to eris
eris is good and botkit is just discordjs dumbed down to the point it makes you look like you add spaces before marks
Hi everyone, I made some changes based on some feedback from some folks at discord.js
I may make an eris version in the future, it sounds very interesting.
Also here’s an example of usage of ambient https://glitch.com/edit/#!/honk-honk?path=skills/hears.js:14:8
I was thinking about recreating the botkit for eris.
I’ve been trying to work out how to use the Conversations feature of Botkit in this example - either I get no responses or I crash the application.
Anyone have a working, minimal example of asking a question and acting on the response using Conversations (rather than doing all the parsing myself)?
Interesting question, I don’t see any references to it in the BotKit Discord code:
You might want to file an issue there. If I have time I’ll try to make it work myself but my instinct is that I might have to contrib code to botkit-discord to make it work.
It’s in the “Advanced Usage” section of the readme for Botkit-Discord, for example convo.AddQuestion and convo.say are both parts of the conversations API in Botkit.
bot.createConversation(message, (err, convo) => {
convo.addQuestion('How would rate that from a scale of 0 to 5?', (response, convo) => {
const numberRating = response.text.match(/[0-5]/g);
if (numberRating.length < 1) {
convo.say('Uhh... not a valid rating, try again later!');
convo.next();
}
convo.say('Oh wow! Thanks for letting me know!');
db.save(message.member.id, numberRating[0]);
convo.next();
});
});
Hey, how can i activate my bot without saying @botnamehere?
If you set up the .hears() function adding “ambient” to the list it will respond anytime it hears the keywords - codingbyhim posted an example above on Sep 19