discord.js-selfbot-v13
discord.js-selfbot-v13 copied to clipboard
Missing Permissions
Which package has the bugs?
The core library
Issue description
When I do a message.edit() with content it tells me I don't have permissions, but when I do it myself it works.
Code sample
message.edit({content: "fzefrz"})
Package version
3.1.4
Node.js version
v20.12.2.
Operating system
windows
Priority this issue should have
Medium (should be fixed soon)
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shared the entire traceback.
- [X] I am using a user token (and it isn't visible in the code).
Additional Information
No response
I know it sounds a bit dumb but are you making sure that the message you are trying to edit is a message you sent?
I know it sounds a bit dumb but are you making sure that the message you are trying to edit is a message you sent?
yes, it's a message that I'm sending and coming from me
aiko can u reply?
Hello, i found the error its when u make the request patch to edit a message, if u have some data in the body that may be null, discord will claim it as non nullable and try to make a request without the required permissions.I just deleted the null proprietes on the body here is the fix on the APIRequest.js
if(this.method == "patch") {
body = JSON.parse(body)
for(const key in body) {
if(body[key] == null || Array.isArray(body[key]) && body[key].length == 0) {
delete body[key];
}
}
body = JSON.stringify(body)
//return fetch(url,{method: "patch",body: JSON.stringify(body ),headers: {"Content-type": "application/json",Authorization: headers.Authorization}}).finally(() => clearTimeout(timeout));
}
return fetch(url, {
method: this.method,
headers,
agent,
body,
signal: controller.signal,
}).finally(() => clearTimeout(timeout));
}
}
izi
You mustnt do that bc it will affect other code
so can u pls find an alternative?
so can u pls find an alternative?
I tried it but it didn't cause any error
client.on('ready', async (client) => {
console.log('Ready!', client.user.tag);
const c = client.channels.cache.get('id');
const m = await c.send('abc');
m.edit({
content: 'def'
});
});
its when u have only message perm on a server and others like attachements or voice message