Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't send messages to channels? #10

Open
VioletFlare opened this issue Sep 3, 2021 · 1 comment
Open

Can't send messages to channels? #10

VioletFlare opened this issue Sep 3, 2021 · 1 comment

Comments

@VioletFlare
Copy link

VioletFlare commented Sep 3, 2021

I can fetch the guilds and the channels but I can't send messages to the channels. Currently using discord.js 12.5.3.

Basically, what I am doing with the code (i am using the latest 1.0.3 version from npm) is providing the token from my browser session. Thus instantiating the client login.

And then getting the channel I want, like so:

client.on("ready", async () => {
    const guild = client.guilds.cache.find(
        guild => guild.name === guildname 
    )

    channel = guild.channels.cache.find(
        channel => channel.name === channelname
    );
})

Then at some point i'd like to use:

channel.send(messageString);

At this point i get the following error:

DiscordAPIError: 401: Unauthorized
    at RequestHandler.execute (C:\Users\x\Desktop\code\selfbot\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\x\Desktop\code\selfbot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/<channelnumber>/messages',
  code: 0,
  httpStatus: 401
}

Is this discord finally disallowing selfbots or it can be fixed?

P.S. <channelnumber> - I have omitted the channel number from the code quote manually.

@Alliegaytor
Copy link

The exact same issue is present on discord.js 12.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants