Hi everyone! We just released a an Official Glitch Discord Bot starter. It has an interactive install guide that will teach you what you need to know to get started with your first (or 100th) Discord Bot on Glitch:
It comes with a video that will help you get started!
Please check it out and we’d love your feedback. We’ve also created some remixes of it that provide demos of what you can do with it. We’re happy to create more if you have an example you’d like us to show you how to make:
yeah, discord gives mentions in wrong order, but that’s not my concern.
.array()[0]
just call first() on collection instead of calling the array method and accessing it’s first element.
imo looks nicer and probably is more performant(?).
but uh- if you want to get the correct mention you probably should just parse the message using provided regex in message.mention property
Yep, it has both Discord.js and Botkit (since the Botkit Discord depends on Discord.js). It’s possible I will refactor in the future as Botkit has a new version out that may not be as compatible with Discord.
There are a lot of things I like in Botkit like:
Storage connectors- makes it easier to swap out databases
Syntax - I like how readable the code is
Documentation- I think the documentation is easier to understand than the Discord.js is, but that’s just a personal opinion
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!
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();
});
});
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