I have a working slash mand, which is great. I can use the mand with one input parameter eg /mand string
and it will execute the mand.
However I am looking to set up a Discord bot that uses that mand in a channel every 5 or so minutes. I can't seem to get the bot to use the mand, any ideas on how to get it to work?
It just displays the string in the channel but the bot doesn't execute the mand.
bot.on('messageCreate', async (msg) => {
if (msg.content === "!loop") {
interval = setInterval (function () {
msg.channel.send("/mand string")
}, 3 * 1000);
}
})
I have a working slash mand, which is great. I can use the mand with one input parameter eg /mand string
and it will execute the mand.
However I am looking to set up a Discord bot that uses that mand in a channel every 5 or so minutes. I can't seem to get the bot to use the mand, any ideas on how to get it to work?
It just displays the string in the channel but the bot doesn't execute the mand.
bot.on('messageCreate', async (msg) => {
if (msg.content === "!loop") {
interval = setInterval (function () {
msg.channel.send("/mand string")
}, 3 * 1000);
}
})
Share
Improve this question
edited Oct 23, 2021 at 13:30
Taku
33.8k12 gold badges78 silver badges87 bronze badges
asked Oct 23, 2021 at 5:43
JasonTJasonT
631 silver badge5 bronze badges
3
- All normal bots ignore messages/mands from other bots so you can't abuse your own bot – MegaMix_Craft Commented Oct 23, 2021 at 5:45
- Dammit... I want to abuse my own bot lol. Hmm will have to think of a work around – JasonT Commented Oct 23, 2021 at 6:00
-
I don't think bots can see nor run slash mands, whether your own or any other bots'. Your code doesn't work because
channel.send
can only send text, starting with a slash doesn't turn it into a slash mand call. – Taku Commented Oct 23, 2021 at 7:00
1 Answer
Reset to default 5Bots can only receive Application Command Interactions, not create them. This means your bot won't be able to run other bot's slash mands, click their buttons or use their dropdown menus.
If you have control over the other bot's code, though, you can set it up to listen for messages (not interactions) from your second bot, and run code accordingly.
But be aware: as MegaMix mentioned in their ment, if the bot you want to control isn't yours, you probably won't be able to do that, as it is a best practice to ignore messages from other bots to prevent abuse and infinite loops.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745621900a4636569.html
评论列表(0条)