discord-akairo / discord-akairo

A bot framework for Discord.js.
https://discord-akairo.github.io/
MIT License
557 stars 128 forks source link

Bot not listening to command sent from another bot via Webhook #193

Closed rijvirajib closed 3 years ago

rijvirajib commented 3 years ago

Hello! Most of my code has this at the top of each exec:

if (message.author.bot) {
   return
 }

One of my commands, let's say !update does not. I want it to listen to bots (in this case MEE6) which, on a timer, will send a message !update to the channel I want.

Testing it as a regular user (or owner), the bot listens fine and works fine. When testing it with the MEE6 bot, the bot doesn't even register a command (as if no command was ever sent).

I tried a few workarounds like changing the prefix to a non standard qqq and other stuff but no luck.

Is this an issue with Discord Akairo or with the way MEE6 sends a command? I have no Inhibitors. It looks like MEE6 is sending this message via Webhook, is there something special I need to do? An image of the issue: https://i.imgur.com/cKOLoL3.png

My index.js:

class RuthgarsClient extends AkairoClient {
  constructor() {
    super({
      ownerID: ['env.OWNER_ID'],
    }, {
      disableMentions: 'everyone',
      partials: ['CHANNEL', 'GUILD_MEMBER', 'MESSAGE','REACTION', 'USER']
    })

    this.commandHandler = new CommandHandler(this, {
      directory: './commands/',
      prefix: '!',
      defaultCooldown: 1000,
      ignoreCooldown: [env.OWNER_ID]
    })
    this.commandHandler.loadAll()

    this.listenerHandler = new ListenerHandler(this, {
      directory: './listeners/'
    })

    this.commandHandler.useListenerHandler(this.listenerHandler)
    this.listenerHandler.loadAll()
  }
}

const client = new RuthgarsClient()
client.login(process.env.DISCORD_TOKEN)
rijvirajib commented 3 years ago

Interesting, looking at the DiscordJS and issues, it looks like I need to use WebhookClient? https://github.com/discord-akairo/discord-akairo/pull/78

lavgup commented 3 years ago

Set CommandHandler.blockBots to false

rijvirajib commented 3 years ago

That was it, thanks!