question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Are you interested in a contribution for adding Reaction bots to Akairo?

See original GitHub issue

I have a basic implementation of a ReactionHandler and Reaction that allow for Reaction “commands” to be written.

Similar to Commands, Inhibitors and Listeners, you add a ReactionHandler in your client constructor like this:

super({ ownerID: OWNER_ID, partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
this.reactionHandler = new ReactionHandler(this, { directory: 'src/reactions/' }).loadAll();

Notice that for reactions to old messages to work, you have to configure discord.js with at least the three partials listed above.

Then place a file like this log.js into src/reactions:

const Reaction = require("../struct/Reaction");
class LogReaction extends Reaction {
  constructor() {
    super('log-reactions', {});
  }
  exec(reaction, reactionType, user) {
    console.log(`User <@${user.id}> ${reactionType} ${reaction.emoji} to/from ${reaction.message.id}.`);
  }
}
module.exports = LogReaction;

I intend to add Inhibitors and possibly the ability to filter out reactions from bots, etc as is possible with Commands. I’m not currently planning on adding Cooldowns, Typing indication, Permissions, etc. I’m curious if folks are interested in a contribution like this and if it would be accepted as a contribution?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
binduwavellcommented, Oct 20, 2020

It’s not different. What it does is integrate doing so the same way that that Command and CommandHandler integrate listening for the message (and possibly messageUpdate) events.

0reactions
binduwavellcommented, Oct 24, 2020

I really want to add Inhibitors for reactions as well. As such I’m thinking of renaming Reaction to ReactionCommand and ReactionHandler to ReactionCommandHandler. Then We can have ReactionInhibitor and ReactionInhibitorHandler.

As an alternative, maybe Inhibitor and InhibitorHandler could be made more generic so they can inhibit Commands and Reactions.

@1Computer1 if you are interested in such a contribution, I’d love to know how you think this should be handled?

Read more comments on GitHub >

github_iconTop Results From Across the Web

discord-akairo/discord-akairo: A bot framework for Discord.js.
Features. Completely modular commands, inhibitors, and listeners. Reading files recursively from directories. Adding, removing, and reloading modules.
Read more >
Discord mod bot github - Allevamento di Casa Lopresti
In this we will be creating a simple discord bot which retur **pong** when we type ... High Quality Music Radio, Moderation, Custom...
Read more >
Check if user have the role x when he add a reaction and give ...
When do you want the bot to give the role? Check if the checks are right. Your code executes the second if only...
Read more >
basic discord bot github
Contribute to rx0f/simple-discord-bot development by creating an account on GitHub. ... Add as many reaction roles as you want to your message!
Read more >
How to Make a Discord Bot: An Overview and Tutorial - Toptal
3) Add a bot user connected to the application. screenshot of adding a bot user. 4) Turn off the PUBLIC BOT switch and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found