Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
applicationCommandPermissionsUpdate
event (#9121)
* fix: applicationcommandpermissionupdate * fix: missing types * Update index.d.ts
- Loading branch information
Showing
7 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
const Action = require('./Action'); | ||
const { Events } = require('../../util/Constants'); | ||
|
||
/** | ||
* The data received in the {@link Client#event:applicationCommandPermissionsUpdate} event | ||
* @typedef {Object} ApplicationCommandPermissionsUpdateData | ||
* @property {Snowflake} id The id of the command or global entity that was updated | ||
* @property {Snowflake} guildId The id of the guild in which permissions were updated | ||
* @property {Snowflake} applicationId The id of the application that owns the command or entity being updated | ||
* @property {ApplicationCommandPermissions[]} permissions The updated permissions | ||
*/ | ||
|
||
class ApplicationCommandPermissionsUpdateAction extends Action { | ||
handle(data) { | ||
const client = this.client; | ||
/** | ||
* Emitted whenever permissions for an application command in a guild were updated. | ||
* <warn>This includes permission updates for other applications in addition to the logged in client, | ||
* check `data.applicationId` to verify which application the update is for</warn> | ||
* @event Client#applicationCommandPermissionsUpdate | ||
* @param {ApplicationCommandPermissionsUpdateData} data The updated permissions | ||
*/ | ||
client.emit(Events.APPLICATION_COMMAND_PERMISSIONS_UPDATE, { | ||
permissions: data.permissions, | ||
id: data.id, | ||
guildId: data.guild_id, | ||
applicationId: data.application_id, | ||
}); | ||
} | ||
} | ||
|
||
module.exports = ApplicationCommandPermissionsUpdateAction; |
5 changes: 5 additions & 0 deletions
5
src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = (client, packet) => { | ||
client.actions.ApplicationCommandPermissionsUpdate.handle(packet.d); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters