title: Slash Commands "unknown interaction"
body: <p>it was a silly error ( &quot; } &quot; in the wrong position ), whoever is interested in this handler I upgraded to v13 is very simple but it works well with it.</p>
  <p><a href="https://github.com/Inkeee/Tutorial-Discord-Bot" rel="nofollow noreferrer">https://github.com/Inkeee/Tutorial-Discord-Bot</a></p>
  <p>Well, I was trying to learn about slash commands, and in the meantime I did a handler based on some videos, and github, but when executing a slash command the error is thrown x times the number of existing commands.  (There are 3 commands, if I use a command the console receives 2 errors)</p>
  <p>I suppose the bot is trying to execute all commands, but I don't know exactly what it is, or why!</p>
  <p>my code:</p>
  <pre class="lang-js prettyprint-override"><code>const { fs, Discord, erros, colors, emojis, database } = require('../../exports.js');
  
  const slash = [];
  
  const arquivos = fs.readdirSync(&quot;./src/slash&quot;).filter((file) =&gt;
      file.endsWith(&quot;.js&quot;))
      
  module.exports = async (client) =&gt; {
    
    for (const files of arquivos) {
      
          const file = require(`../../slash/${files}`);
        
          slash.push(file);
        client.api.applications(client.user.id).commands.post({data: file.data})
      }
  
      client.ws.on('INTERACTION_CREATE', async (i) =&gt; {
          
          const command = slash.find(cmd =&gt; cmd.data.name === i.data.name.toLowerCase())
         
          if(command) command.execute(client, send, i);
       
        })
       
        async function send(interaction, content) {
          return client.api.interactions(interaction.id, interaction.token).callback.post({
            data: {
                  type: 4,
                  data: await msg(interaction, content),
              },
          });
      }
  
       
        async function msg(i, c) {
          const m = await Discord.APIMessage.create(client.channels.resolve(i.channel_id), c)
            .resolveData()
            .resolveFiles();
  
          return { ...m.data, files: m.files }
        }
        
  }
  
  module.exports.help = {
    name: &quot;ready&quot;,
    title: &quot;Comandos slashs&quot;
  }
  </code></pre>
  <p>the event handlers get normal, the only problem is in the send function, in command</p>
  <pre class="lang-js prettyprint-override"><code>const { Discord, erros, colors, emojis, database, titles} = require('../exports.js');
  
  module.exports = {
    data: {
      name: &quot;say&quot;,
      description: &quot;Faça o bot falar&quot;,
        options: [{
          name: &quot;text&quot;, 
          description: &quot;texto que vai na mensagem&quot;,
          type: 3,
          required: true
        }]
    },
    async execute (client, send, i) {
      
      var args = i.data.options
      
      var texto = args.find(args =&gt; args.name.toLowerCase() === &quot;text&quot;).value;
       
      await send(i, texto)
      
    }
  }
  </code></pre>
  <p>Err:</p>
  <pre><code>(node:84) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown interaction at RequestHandler.execute (/home/runner /Shinobu/node_modules/discord.js/src/rest/R equestHandler.js:154:13) at processTicksAndRejections (internal/ process/task_queues.js:97:5) at async RequestHandler.push ner/Shinobu/node_modules/discord.js/src/res t/RequestHandler.js:39:14) at Object.execute (/home/runner/S hinobu/src/slash/say.js:20:5) ```
  </code></pre>