SIA
Sapphire - Imagine a frameworkDeadlystrike
requiredClientPermissions check always rejecting
While
requiredUserPermissions: ['ManageRoles']
works great. The client check requiredClientPermissions: ['ManageRoles']
seems to always block.
It is throwing not a specific missing permissions error but an I was unable to resolve my permissions in the ${commandType} command invocation channel.
Unless I am doing something wrong, it looks like the problem is that the check is referencing the application id channel.permissionsFor(interaction.applicationId)
when it should be referencing either the clients guild member or user ID.
https://github.com/sapphiredev/framework/blob/179b21e7f74c4d9a506e1be98d7487f939ec0ae7/src/preconditions/ClientPermissions.ts#L71
When testing channel.permissionsFor(interaction.applicationId)
always resolved null, where as channel.permissionsFor(interaction.client.user.id)
and `channel.permissionsFor(interaction.guild.members.me)
always gave a valid bitfield
Solution:
Closing this as the fix has been released in v4.2.1
GitHub
framework/ClientPermissions.ts at 179b21e7f74c4d9a506e1be98d7487f93...
Discord bot framework built on top of discord.js for advanced and amazing bots. - framework/ClientPermissions.ts at 179b21e7f74c4d9a506e1be98d7487f939ec0ae7 · sapphiredev/framework
W
WhacK•436d ago
I use this on my bot and it works every time. I apply it via the decorator but I don’t think that matters. Did you ensure that permission was clicked when generating the invite? Mine used an admin link.
D
Deadlystrike•436d ago
The bot has been in my server for years, no clue how I invited it. For sanity sake I kicked it and re-invited it with a fresh invite link with all permissions selected
&permissions=1099511627775&scope=bot
- Additionaly upon joining I gave it an existing role that has admin perms in addition to the managed role it already had.
Same output: 'I was unable to resolve my permissions in the chat input command invocation channel.'
W
WhacK•436d ago
Weird. I looked at my intents and nothing there to do with roles. Maybe someone smarter than I am can help
F
Favna•436d ago
@Vladdy there shouldn't be a difference between the IDs?
V
vladdy•436d ago
Old applications have different ids
Between app and user
But I'm talking old old
@Deadlystrike can you log your clients user id and the interactions applicationId please
D
Deadlystrike•436d ago
I do believe that I saw my client users id and the app id was different but let me recheck
V
vladdy•436d ago
You can see that in the dev portal too tbf
D
Deadlystrike•436d ago
they are diff
V
vladdy•436d ago
..how old is your app
V
vladdy•436d ago
Snow-Stamp
Discord Snowflake to Timestamp Converter
Get the exact time and date from a Discord Snowflake
D
Deadlystrike•436d ago
Dev Bot: 8/1/2016
Production Bot: 7/15/2016
V
vladdy•436d ago
.........first off thanks for using sapphire
Secondly yeah that makes sense for it to break then
@Favna we need a client user id fallback
For all permission checks
F
Favna•436d ago
fallback or just always use it
V
vladdy•436d ago
Fallback
Any app past..2017 iirc has them tied
I mean i suppose we can always use it
F
Favna•436d ago
otherwise I'm doing this
V
vladdy•436d ago
...
Are you high
F
Favna•436d ago
no just tired from getting WoL not working
V
vladdy•436d ago
permissions = channel.permissionsFor(interaction.applicationId) ?? channel.permissionsFor(interaction.client.user?.id)
F
Favna•436d ago
send my body a magic packet please
F
Favna•436d ago
created a PR for this @Deadlystrike https://github.com/sapphiredev/framework/pull/616
GitHub
fix(ClientPermissions): fixed permission checking for old applicati...
Warning
This Pull Request needs sapphiredev/utilities#559 to be approved and merged beforehand. Once the linked Pull Request is merged, this one will receive its last commit.
D
Deadlystrike•435d ago
🫡 building the branch now to test
F
Favna•435d ago
If it gives type errors that's because of the linked PR and you can just ts-ignore any problematic lines for now
Strangely it didn't give any in CI...
D
Deadlystrike•435d ago
Looking good so far, re-enabled the
requiredClientPermissions
checks and the command went through just fine, kicked the bot and re-invited with removed permissions and it threw a I am missing the following permissions to run this command: Manage Roles
as i would expect.Solution
F
Favna•434d ago
Closing this as the fix has been released in v4.2.1
Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.2KMembers
View on DiscordWant results from more Discord servers?
More PostsUnable to get member data from users that have left / kickedHi, I am trying to get data from members who have left the discord server or have been kicked. But ICatch all chat input command errors listenerHello ! I tried using the `Events.ChatInputCommandError` listener to catch any errors thrown by the Multiple Clients on one file/instanceI was wondering if its possible to run multiple clients on one file (i.e. .forEach()-ing `new ClientHow to present Slashcommands?How can I present the Slashcommands of my bot in his About Me like for example carl.gg does?Interaction HandlersAm I required to specify to sapphire where my interaction handlers directory is? A `interaction-handbot won't get on and connect to discord.hi, my bot won't turn on. i've coded a lot of bots before with sapphire and they worked just fine, dHow Do I Make a Project in my current Directory?I want to make the proj in `workspaces/DashMate` not like `workspaces/DashMate/${ProjName}`Bot wont go onlinewhen I try to run the script `yarn dev` I get this problemGuildDelete Event somehow gets triggered when I restart my BotI have no idea whats happening but if my bot (docker container) restarts, this notification gets senTypeError: Class extends value undefined is not a constructor or nullHey, newbie here in both TypeScript and Sapphire, and I'm trying to build a command but I'm getting THREAD_CREATE event Listener run method argumentsWhat I want to do:
I want to inspect the id of the parent channel where the thread was created.
TheCommand info command issueI have a command info command, but when I try to get information on a command called "flags" it retuawait args.pick("member");how to enable this?
https://discord.com/channels/737141877803057244/737142071319855105/107804884825Command info command issueI have a command info command, but when I try to get information on a command called "flags" it retuRunning in productionHey! What's the recommended method for starting up a node app in production? Specifically for DiscorspeakerName translation in FFXIVIpcChatHello everyone,
I'm using ffxiv-pcap to read chat messages using the Sapphire Struct for chat messagClearing registered slash commandsHello 👋
I would like to know if there's a system provided by Sapphire to automatically clear previDocker being goofyI have no idea why Docker is being all goofy, it's saying that my discord token is invalid, but it'sReferenceError: [ENV] BOT_OWNER_IDS - The key must be an array, but is empty or undefined.I am using `@skyra/env-utilities` and when I start up my bot, I get the error reported in the title How can I turn a joinedTimestamp into this Discord TimestampThe one that automatically shows you like how long ago this timestamp was