Hello there. I'll make this quick. In sort, I am making a command that applies slash command permission overwrites to servers based on a file it reads. Now, I did manage to write everything that sets up the properties object to be applied to the
guild.commands.permissions.set()
guild.commands.permissions.set()
function, but for some reason, it just does not accept it. Here is an overview of the important chunks of code:
const guildPermissions: {id: string, permissions: ApplicationCommandPermissions[]}[] = []{ // This is a loop const permissions: ApplicationCommandPermissions[] = [] { // This is also a loop permissions.push({ id: roleId, type: ApplicationCommandPermissionType.Role, permission: true }) } guildPermissions.push({ id: commandId, permissions, })}guild.commands.permissions.set({ token: process.env.DISCORD_TOKEN, permissions: guildPermissions // The "permissions" key is highlighted red with an error})
const guildPermissions: {id: string, permissions: ApplicationCommandPermissions[]}[] = []{ // This is a loop const permissions: ApplicationCommandPermissions[] = [] { // This is also a loop permissions.push({ id: roleId, type: ApplicationCommandPermissionType.Role, permission: true }) } guildPermissions.push({ id: commandId, permissions, })}guild.commands.permissions.set({ token: process.env.DISCORD_TOKEN, permissions: guildPermissions // The "permissions" key is highlighted red with an error})
The error I get is the following:
Type '{ id: string; permissions: ApplicationCommandPermissions[]; }[]' is not assignable to type 'readonly ApplicationCommandPermissions[]'. Type '{ id: string; permissions: ApplicationCommandPermissions[]; }' is missing the following properties from type 'ApplicationCommandPermissions': type, permissionts(2322)index.d.ts(4620, 3): The expected type comes from property 'permissions' which is declared here on type '{ command: ApplicationCommandResolvable; } & EditApplicationCommandPermissionsMixin'
Type '{ id: string; permissions: ApplicationCommandPermissions[]; }[]' is not assignable to type 'readonly ApplicationCommandPermissions[]'. Type '{ id: string; permissions: ApplicationCommandPermissions[]; }' is missing the following properties from type 'ApplicationCommandPermissions': type, permissionts(2322)index.d.ts(4620, 3): The expected type comes from property 'permissions' which is declared here on type '{ command: ApplicationCommandResolvable; } & EditApplicationCommandPermissionsMixin'
I am unsure whether I am doing something wrong or this is a TS issue. If anyone knows how I could solve this, then it would be very helpful. Thank you for your time and help, I truly appreciate it.