Add some permission checks
This commit is contained in:
parent
cbe1de98a5
commit
71fe549ee6
|
@ -261,10 +261,12 @@ export class Guild {
|
||||||
* @param {Number} days
|
* @param {Number} days
|
||||||
*/
|
*/
|
||||||
pruneMembers(days) {
|
pruneMembers(days) {
|
||||||
|
this.assertPermissions('KICK_MEMBERS', Modules.DiscordPermissions.KICK_MEMBERS);
|
||||||
Modules.PruneMembersModal.prune(this.id, days);
|
Modules.PruneMembersModal.prune(this.id, days);
|
||||||
}
|
}
|
||||||
|
|
||||||
openPruneMumbersModal() {
|
openPruneMumbersModal() {
|
||||||
|
this.assertPermissions('KICK_MEMBERS', Modules.DiscordPermissions.KICK_MEMBERS);
|
||||||
Modules.PruneMembersModal.open(this.id);
|
Modules.PruneMembersModal.open(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +274,7 @@ export class Guild {
|
||||||
* Opens the create channel modal for this guild.
|
* Opens the create channel modal for this guild.
|
||||||
* @param {Number} type The type of channel to create - either 0 (text), 2 (voice) or 4 (category)
|
* @param {Number} type The type of channel to create - either 0 (text), 2 (voice) or 4 (category)
|
||||||
* @param {ChannelCategory} category The category to create the channel in
|
* @param {ChannelCategory} category The category to create the channel in
|
||||||
* @param {GuildChannel} clone A channel to clone permissions of
|
* @param {GuildChannel} clone A channel to clone permissions, topic, bitrate and user limit of
|
||||||
*/
|
*/
|
||||||
openCreateChannelModal(type, category, clone) {
|
openCreateChannelModal(type, category, clone) {
|
||||||
this.assertPermissions('MANAGE_CHANNELS', Modules.DiscordPermissions.MANAGE_CHANNELS);
|
this.assertPermissions('MANAGE_CHANNELS', Modules.DiscordPermissions.MANAGE_CHANNELS);
|
||||||
|
@ -296,7 +298,7 @@ export class Guild {
|
||||||
parent_id: category ? category.id : undefined,
|
parent_id: category ? category.id : undefined,
|
||||||
permission_overwrites: permission_overwrites ? permission_overwrites.map(p => ({
|
permission_overwrites: permission_overwrites ? permission_overwrites.map(p => ({
|
||||||
type: p.type,
|
type: p.type,
|
||||||
id: p.type === 'user' ? p.userId : p.roleId,
|
id: (p.type === 'user' ? p.userId : p.roleId) || p.id,
|
||||||
allow: p.allow,
|
allow: p.allow,
|
||||||
deny: p.deny
|
deny: p.deny
|
||||||
})) : undefined
|
})) : undefined
|
||||||
|
|
Loading…
Reference in New Issue