-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Type error with permissionOverwrites #10450
Comments
If you supply a snowflake as the id of an OverwriteData object and don't specify a type, then the user/role needs to be cached (otherwise d.js can't work out whether to set a role overwrite or a member overwrite). If you don't know that the user/role is cached from context, then you can either pass the User/Role object directly as you mentioned, or supply a value for channel.permissionOverwrites
.set([
{
id: client.user.id,
type: 'member',
allow: [
'SendMessages',
],
},
]); |
That's correct. I believe it would be a good idea to adjust the error message here as it is misleading (the supplied parameter was indeed a user or a role). It should ideally mention that it was unable to resolve the type from the cache. |
I suppose the alternative (albeit breaking) approach would be to switch to using |
can i work on this. |
Yes. If you know how to, feel free to open a pull request. |
sure, thank you @didinele |
@Waheedsys Hi, are you skilled to work the issue, if not let me take over. Thanks. |
close discordjs#10450 Revised error message
Hey @Jiralite, could you please check if the ESLint error has been resolved? Thanks! |
Which package is this bug report for?
discord.js
Issue description
With an existing guild text channel, an error is thrown when setting the
permissionOverwrites
with the required types.Here is an example
An error will be thrown
And the typings for this method I am using have
id
as aSnowflake
When using the
client.user
instead, there is no issue and the permissions are correctly changed.Code sample
No response
Versions
Issue priority
Low (slightly annoying)
Which partials do you have configured?
Not applicable
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: