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
697 stars 143 forks source link

message.Clickbutton failing to find buttons And displaying incorrect error. #1195

Closed IanMullins closed 1 day ago

IanMullins commented 2 weeks ago

Which package has the bugs?

The core library

Issue description

A long functioning feature of my bot no longer works. Buttons of a message can no longer be clicked. Seems like the button is not properly found on the message, and so the button is undefined causing errors.

Additionally the wrong error message is displaying.

/home/dev/backend/node_modules/discord.js-selfbot-v13/src/structures/Message.js:1017
    button = button.toJSON();
                    ^

TypeError: Cannot read properties of undefined (reading 'toJSON')
    at Message.clickButton (/home/dev/backend/node_modules/discord.js-selfbot-v13/src/structures/Message.js:1017:21)
    at /home/dev/backend/routes/router.js:250:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

A trival modification of moving the .toJSON() call down a line image returns the correct error.

/home/dev/backend/node_modules/discord.js-selfbot-v13/src/structures/Message.js:1018
    if (!button) throw new TypeError('BUTTON_NOT_FOUND');
                       ^

TypeError: BUTTON_NOT_FOUND
    at Message.clickButton (/home/dev/backend/node_modules/discord.js-selfbot-v13/src/structures/Message.js:1018:24)
    at /home/dev/backend/routes/router.js:251:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Code sample

const channel = client.channels.cache.get("1103168663617556571")
console.log(targetmessage)
const message = await channel.messages.fetch(request.body.message_id)
#yes I confirmed messages.fetch is finding a valid message with button components. 
message.clickButton({ row: 0, col: 0})
#error here

Package version

├── discord.js-selfbot-v13@3.1.4

Node.js version

v20.9.0

Operating system

No response

Priority this issue should have

Medium (should be fixed soon)

Checklist

Additional Information

Sorry If this issue sucks. First time I made one.

aiko-chan-ai commented 2 weeks ago

I will keep it open until I update the new version on npm

aiko-chan-ai commented 1 day ago

okie