nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/actions/MessageCreate.js:31 const message = channel._cacheMessage(new Message(channel, data, client)); #3883

Closed hdanqjz closed 8 months ago

hdanqjz commented 2 years ago

Details

i run this code and have a problem:

const keepAlive = require("./server")
let discord = require('discord.js-selfbot-v11')
let rpcGenerator = require("discordrpcgenerator")
const dotenv = require('dotenv');
const TOKEN = (process.env.TOKEN);
var uuid = ()=>([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,a=>(a^Math.random()*16>>a/4).toString(16))
let client = new discord.Client()

keepAlive()
client.login(TOKEN)

client.on("ready", () => {
    rpcGenerator.getRpcImage("985009319558909962", "pic1")
    .then(image => {
        let presence = new rpcGenerator.Rpc()
        .setName("twitch")
        .setUrl("https://www.youtube.com/watch?v=Bmkx8QaM0dM")
        .setType("STREAMING")
        .setApplicationId("985009319558909962")
        .setAssetsLargeImage(image.id)
        .setAssetsLargeText("https://discord.gg/DTC")
        .setDetails("Join DTC to see my penis")
 client.user.setPresence(presence.toDiscord())
    }).catch(console.error)
console.log(`${client.user.username} Successfully Logged in!`)
})

console

/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/actions/MessageCreate.js:31
        const message = channel._cacheMessage(new Message(channel, data, client));
                                ^

TypeError: channel._cacheMessage is not a function
    at MessageCreateAction.handle (/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/actions/MessageCreate.js:31:33)
    at MessageCreateHandler.handle (/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/websocket/packets/handlers/MessageCreate.js:8:51)
    at WebSocketPacketManager.handle (/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/websocket/WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (/home/runner/same-spotify/node_modules/discord.js-selfbot-v11/src/client/websocket/WebSocketConnection.js:296:17)
    at WebSocket.onMessage (/home/runner/same-spotify/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (node:events:394:28)
    at Receiver.receiverOnMessage (/home/runner/same-spotify/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (node:events:394:28)
    at Receiver.dataMessage (/home/runner/same-spotify/node_modules/ws/lib/receiver.js:422:14)
exit status 1

Node.js version

v16.7.0

Example code

No response

Operating system

node v16.7

Scope

node

Module and version

Not applicable.

hdanqjz commented 2 years ago

i can't fix it :(

F3n67u commented 2 years ago

The problem is the channel object in channel._cacheMessage is not a channel that has the _cacheMessage function. but discord.js-patched-v11 has not checked this situation.

Could you report this problem to https://github.com/Carcraftz/discord.js-patched-v11 repo? I think this problem will be solved better at discord.js-patched-v11, because solving it will require a lot of knowledge about discord.js-patched-v11 package.

F3n67u commented 2 years ago

I give another try to reproduce your problem but failed. The following problem blocks me:

  1. I have no process.env.TOKEN to call login(token)
  2. The ./server file is missing
VoltrexKeyva commented 2 years ago

discord.js-selfbot-v11 no longer works as it uses discord.js v11, discord.js v11 no longer works as it's pretty old and haven't been patched to handle new requests properly and other things.

And self-botting is against Discord's ToS (Terms of Service), so I would advise not doing this.

F3n67u commented 2 years ago

discord.js-selfbot-v11 no longer works as it uses discord.js v11, discord.js v11 no longer works as it's pretty old and haven't been patched to handle new requests properly and other things.

And self-botting is against Discord's ToS (Terms of Service), so I would advise not doing this.

@VoltrexMaster Awesome! I forgot that you are Discord bot expert. 😜

sirzento commented 2 years ago

Quick fix if using discord.js v11: Go to node_modules/discord.js/src/client/actions/MessageCreate.js at row 10 and replace

if(channel) {

with

if (channel && typeof channel._cacheMessage === "function") {

Majordi commented 2 years ago

It's still not working

github-actions[bot] commented 9 months ago

There has been no activity on this issue for 11 months. The help repository works best when sustained engagement moves conversation forward. The issue will be closed in 1 month. If you are still experiencing this issue on the latest supported versions of Node.js, please leave a comment.

github-actions[bot] commented 8 months ago

Closing after no activity on this issue for 12 months.