aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
751 stars 160 forks source link

Slash Commands #160

Closed xHaruke closed 2 years ago

xHaruke commented 2 years ago

Issue description

I am just trying to send an application command

Code sample

client.on("messageCreate", async (message) => {
  if (message.content === "a") {
    await message.guild.searchInteraction({
      query: "help",
      botId: "302050872383242240",
    });
    message.channel.sendSlash("302050872383242240", "help");
  }
});

Package version

2.2.0

Node.js version

16.14.0

Operating system

windows

Priority this issue should have

Medium (should be fixed soon)

Checklist

Additional Information

error

C:\Users\someone\node_modules\discord.js-selfbot-v13\src\client\websocket\handlers\GUILD_APPLICATION_COMMANDS_UPDATE.js:13 client.users.cache.get(data.application_commands[0].application_id).applications.cache, ^

TypeError: Cannot read properties of undefined (reading 'applications') at Object.module.exports [as GUILD_APPLICATION_COMMANDS_UPDATE] (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\src\client\websocket\handlers\GUILD_APPLICATION_COMMANDS_UPDATE.js:13:72) at WebSocketManager.handlePacket (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\src\client\websocket\WebSocketManager.js:346:31) at WebSocketShard.onPacket (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\src\client\websocket\WebSocketShard.js:478:22)
at WebSocketShard.onMessage (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\src\client\websocket\WebSocketShard.js:317:10)
at WebSocket.onMessage (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\node_modules\ws\lib\event-target.js:199:18) at WebSocket.emit (node:events:520:28) at Receiver.receiverOnMessage (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\node_modules\ws\lib\websocket.js:1169:20)
at Receiver.emit (node:events:520:28) at Receiver.dataMessage (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\node_modules\ws\lib\receiver.js:528:14) at Receiver.getData (C:\Users\arvind kumar\node_modules\discord.js-selfbot-v13\node_modules\ws\lib\receiver.js:446:17)

aiko-chan-ai commented 2 years ago

it was a bug, you can wait for the fix in version 2.3

xHaruke commented 2 years ago

@aiko-chan-ai any way around it?

aiko-chan-ai commented 2 years ago

@aiko-chan-ai any way around it?

you can fix it temporarily by replacing searchInteraction with this image force: true

xHaruke commented 2 years ago

@aiko-chan-ai

await client.applications.fetch({
                          ^

TypeError: Cannot read properties of undefined (reading 'fetch')

aiko-chan-ai commented 2 years ago

TypeError: Cannot read properties of undefined (reading 'fetch')

no

const bot = await client.users.fetch('idbot')
await bot.applications.fetch({ ...
xHaruke commented 2 years ago

@aiko-chan-ai

Code :

client.on("messageCreate", async (message) => {
  if (message.content === "a") {
    const bot = await client.users.fetch("302050872383242240");
    await bot.applications.fetch({
      guildId: "771238821550620703",
      force: "true",
    });
    message.channel.sendSlash("302050872383242240", "help");
  }
});

Error :

      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: You are not authorized to perform this action on this application
    at RequestHandler.execute (C:\Users\arvind kumar\Desktop\Desktop\Coding stuff\Node\slash selfbot\node_modules\discord.js-selfbot-v13\src\rest\RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\arvind kumar\Desktop\Desktop\Coding stuff\Node\slash selfbot\node_modules\discord.js-selfbot-v13\src\rest\RequestHandler.js:51:14)
    at async ApplicationCommandManager.fetch (C:\Users\arvind kumar\Desktop\Desktop\Coding stuff\Node\slash selfbot\node_modules\discord.js-selfbot-v13\src\managers\ApplicationCommandManager.js:102:18)
    at async Client.<anonymous> (C:\Users\arvind kumar\Desktop\Desktop\Coding stuff\Node\slash selfbot\index.js:11:5) {
  method: 'get',
  path: '/applications/302050872383242240/guilds/771238821550620703/commands',
  code: 20012,
  httpStatus: 403,
  requestData: { json: undefined, files: [] }
}

and I have the perms image

aiko-chan-ai commented 2 years ago

@xHaruke you need to open DMs with bot first (if error You are not authorized to perform this action on this application)

xHaruke commented 2 years ago

@xHaruke you need to open DMs with bot first (if error You are not authorized to perform this action on this application)

what do you mean by open DMs?

aiko-chan-ai commented 2 years ago

what do you mean by open DMs?

image

xHaruke commented 2 years ago

image

did it still not working

aiko-chan-ai commented 2 years ago

did it still not working

if you already did it, you can skip fetch

xHaruke commented 2 years ago

wdym by i can skip fetch?

aiko-chan-ai commented 2 years ago

wdym by i can skip fetch?

https://www.reddit.com/r/Discord_selfbots/comments/tczprx/discum_help_creating_a_selfbot_that_can_do_ping/

.-.