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
825 stars 170 forks source link

Interaction reply messages has empty content #1347

Closed Meff1u closed 10 hours ago

Meff1u commented 2 weeks ago

Which package has the bugs?

The core library

Issue description

  1. on('messageCreate')
  2. the message must be a response to the interaction (not emphemeral, they works lol)
  3. console.log(message) - content is empty

Console.log message content: 1

Message: 2

Code sample

client.on('messageCreate', async (message) => {
    console.log(message)
});

Package version

3.4.2

Node.js version

20.11.1

Operating system

Windows 11

Priority this issue should have

Medium (should be fixed soon)

Checklist

Additional Information

A couple of months ago it was still working. Yesterday I decided to go back to the project I was doing and update it and I just noticed that the content is empty on the interaction responses

Meff1u commented 2 weeks ago

also tried to fetch the message if it is of type 'REPLY', unfortunately the result is the same.

else if (message.type == 'REPLY') {
   const replymessage = await client.channels.cache.get(message.channelId).messages.fetch(message.id);
   console.log(replymessage);
}

1

aiko-chan-ai commented 1 week ago

Can you provide me with a basic code snippet to test? I have botId and command (args). If you’re using a personal bot and prefer not to share details, could you try with a popular bot and let me know?

Meff1u commented 1 week ago

This is what happens when I use the popular bot “Ballsdex”. After catching a ball (it opens a modal in which you have to enter the correct name) it makes a reply like the one you see in the picture added to this post.

Meff1u commented 1 week ago

I tried to repeat the whole sequence with my own bot (button, modal, interaction reply) only that in my case the content was no longer empty. I use that "You caught ballname" reply to rename local file with that ball name:

client.on('messageCreate', async (message) => {
   if (guilds.includes(message.guildId)) {
      if (message.author.id === '999736048596816014') { //Ballsdex id
         if (message.type == 'REPLY') {
            const replychannel = await client.channels.fetch(message.channelId);
            const replymessage = await replychannel.messages.fetch(message.id);
            if (replymessage.content.includes("You caught")) {
                renameFile(replymessage);
            }
         }
      }
   }
});

^ That's what i have for now and it still doesnt work. The entire event has executed several times, but not once has the renameFile function occurred

Meff1u commented 1 week ago

I just decided to fetch a message whose message.content was empty, but at the once('ready') event and this time the content is not empty, but why is it empty at the messageCreate event? (In addition, it is strange that fetching this message in this event also returns an empty message.content) 1 2

const quicktestch = await client.channels.fetch('825250865408376843');
const quicktestmsg = await quicktestch.messages.fetch('1304529842662019105');
console.log(quicktestmsg);
Meff1u commented 1 week ago

I added a 5-second wait before fetching the message and.... works lol

Inside renameFile():

await new Promise(resolve => setTimeout(resolve, 5000));
const replychannel = await client.channels.fetch(rmessage.channelId);
const message = await replychannel.messages.fetch(rmessage.id);
console.log(message);

1

aiko-chan-ai commented 1 week ago

If so, here’s the response process the bot followed:

You send a command -> Bot replies with defer_reply (an empty message) -> You see this message in your selfbot -> Bot edits the reply -> You see the updated message on Discord.

So, you should use an additional event, messageUpdate, or I could add a method to retrieve edited messages.

sv-du commented 1 week ago

Also having a similar issue, I should just move this logic to a messageUpdate event?

Meff1u commented 1 week ago

Now everything is becoming clear... I'll try moving this to the messageUpdate event and let you know if it works.

Meff1u commented 1 week ago

Yeah, it works fine with messageUpdate event.