Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
A discord bot activating another bot via /commands or detect user who used a bot command

Ok, so Im trying to do the following rn: Im using the Disboard bot and beforehand rewarded users for bumping. That wasnt a problem, because the command was "!d bump", so I could just make my bot to also react on it. They now changed to / commands, so my bot isnt reacting to it anymore. How it is now

So I see two possibilities. I either make a command and than (if thats possible) my bot bumps instead of the user and the user just activates my bot. Or I detect the Bot message and (if thats possible) who used the command and go on from there.

Thanks for help and ideas, and have a great day!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

It is not possible for bots to use other bots' slash commands; however, you can detect when someone uses a command for a certain bot. I will use discord.js v13 in my answer.

client.on("messageCreate", (message) => {
    // check if the message is a slash command
    if (message.type !== "APPLICATION_COMMAND") return;

    message.interaction.commandName

    // if so then you can access the user who triggered the command with
    message.interaction.user;
});

If you want to check for a certain command then you can check message.interaction.commandName and if you only want to listen to commands from a certain bot then you can just check the message.author.id.

about 4 years ago · Juan Pablo Isaza Relatório

0

I've been working on this for quite a bit, but here is how I made it:

if (message.type == "APPLICATION_COMMAND" && message.channel.id == "971729505708290099" && message.interaction.commandName == "bump") {
    message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
        VIEW_CHANNEL: false
    })
    setTimeout(function () {
        message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
            VIEW_CHANNEL: true
        })
    }, 7200000);
}

in this code when someone uses the slash command /bump, it hides the channel and then unhides it after 2 hours. Hope that helps :)

(This code is inside the client.on("messageCreate", (message) =>{})

Instead of hiding channels/showing them you can also just ping a certain role if you want.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda