0

I was making a script using Discord.js-commando to respond to a message, the command to execute this script sent by Streamlabs Chatbot.

Upon sending the message I noticed it did not respond by its own command. Bot name is "Cuartel General", but case in point it didn't even enter the run fn.

Is there a way to make the Bot respond to its own command?

Like so

constructor(client) {
  super(client, {
    name: 'acceso',
    group: 'admin',
    memberName: 'acceso',
    description: 'Generates invite'
  });
}

async run(message, args) {
  if (message.author.username == "Cuartel General") {
    console.log("Bot has access");
  } else {
    console.log("Usuario is not Bot");
  }
}

Any help is appreciated!

Federico Grandi
  • 6,785
  • 5
  • 30
  • 50

1 Answers1

1

Most bots will not answer or react to other bots, because this could create some nasty infinite loops. So most libraries won't allow it by default. The only option you have is either fork one of these libs (like Discord.js-Commando) and change up this behavior or write your own system. I wouldn't recommend it it tho, because of the reason I stated above.

You can see how this is implemented in Discord.js-commando in their github repo.

Xzandro
  • 957
  • 6
  • 14