Interaction Fails from Discord slash commands


I need a bit of help with my code, I don’t get any errors except This Interaction Failed in Discord.

The code I am using for slash commands:

    name: "random",
    description: "Random Message",
    options: [],
    async execute(_bot, say, interaction) {
        var facts = ["test1", "test2", "test3", "test4"];
var fact = Math.floor(Math.random() * facts.length);
        await say(interaction, facts[fact]);

The code that works with my prefix and non-slash command: = async (client, message, args) => {
var facts = ["test", "test2", "test3"];
var fact = Math.floor(Math.random() * facts.length);[fact]);


I had this issue, so I looked over the API documentation again and found that while I was sending a response to the channel, I wasn’t actually responding to the interaction. To respond to the interaction you have to send data to a webhook using the interaction ID and token. From the documentation:

url = "<interaction_id>/<interaction_token>/callback"

json = {
    "type": 4,
    "data": {
        "content": "Congrats on sending your command!"
r =, json=json)

Check out more here:

Answered By – Jaa

Answer Checked By – Cary Denson (AngularFixing Admin)

Leave a Reply

Your email address will not be published.