diff --git a/src/client/components/commands/moderation/Dehoist.ts b/src/client/components/commands/moderation/Dehoist.ts index 0e1ee17..3fa9a38 100644 --- a/src/client/components/commands/moderation/Dehoist.ts +++ b/src/client/components/commands/moderation/Dehoist.ts @@ -3,7 +3,7 @@ import DiscordClient from '../../../DiscordClient.js'; import { Nickname } from '../../../infractions/index.js'; import { CommandError, ModerationCommand } from '../../../interfaces/index.js'; import InvokerWrapper from '../../wrappers/InvokerWrapper.js'; -import UserWrapper from '../../wrappers/UserWrapper.js'; +import MemberWrapper from '../../wrappers/MemberWrapper.js'; class DehoistCommand extends ModerationCommand { @@ -22,15 +22,15 @@ class DehoistCommand extends ModerationCommand } - async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) + async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) { if (!users) throw new CommandError(invoker, { index: 'MODERATION_MISSING_USERS' }); - const wrappers = await Promise.all(users.asUsers.map(user => this.client.getUserWrapper(user))); + const wrappers = await Promise.all(users!.asUsers.map(user => invoker.guild.memberWrapper(user))); return this.client.moderation.handleInfraction(Nickname, invoker, { - targets: wrappers.filter(Boolean) as UserWrapper[], + targets: wrappers.filter(Boolean) as MemberWrapper[], args, data: { dehoist: true diff --git a/src/client/components/commands/moderation/Kick.ts b/src/client/components/commands/moderation/Kick.ts index fae9533..b42f37b 100644 --- a/src/client/components/commands/moderation/Kick.ts +++ b/src/client/components/commands/moderation/Kick.ts @@ -3,7 +3,7 @@ import DiscordClient from '../../../DiscordClient.js'; import { Kick } from '../../../infractions/index.js'; import { ModerationCommand } from '../../../interfaces/index.js'; import InvokerWrapper from '../../wrappers/InvokerWrapper.js'; -import UserWrapper from '../../wrappers/UserWrapper.js'; +import MemberWrapper from '../../wrappers/MemberWrapper.js'; class KickCommand extends ModerationCommand { @@ -21,11 +21,11 @@ class KickCommand extends ModerationCommand }); } - async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) + async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) { - const wrappers = await Promise.all(users!.asUsers.map(user => this.client.getUserWrapper(user))); + const wrappers = await Promise.all(users!.asUsers.map(user => invoker.guild.memberWrapper(user))); return this.client.moderation.handleInfraction(Kick, invoker, { - targets: wrappers.filter(Boolean) as UserWrapper[], + targets: wrappers.filter(Boolean) as MemberWrapper[], args }); } diff --git a/src/client/components/commands/moderation/Roles.ts b/src/client/components/commands/moderation/Roles.ts index ffa4d44..6e96383 100644 --- a/src/client/components/commands/moderation/Roles.ts +++ b/src/client/components/commands/moderation/Roles.ts @@ -2,9 +2,9 @@ import { CommandError, ModerationCommand } from '../../../interfaces/index.js'; import DiscordClient from '../../../DiscordClient.js'; import InvokerWrapper from '../../wrappers/InvokerWrapper.js'; import { CommandOptionType, CommandParams } from '../../../../../@types/Client.js'; -import UserWrapper from '../../wrappers/UserWrapper.js'; import Addrole from '../../../infractions/Addrole.js'; import Removerole from '../../../infractions/Removerole.js'; +import MemberWrapper from '../../wrappers/MemberWrapper.js'; class AddroleCommand extends ModerationCommand { @@ -46,7 +46,7 @@ class AddroleCommand extends ModerationCommand } - async execute (invoker: InvokerWrapper, { users, roles, ...args }: CommandParams) + async execute (invoker: InvokerWrapper, { users, roles, ...args }: CommandParams) { if (!users) @@ -56,9 +56,9 @@ class AddroleCommand extends ModerationCommand const Infraction = invoker.subcommand!.name === 'add' ? Addrole : Removerole; - const wrappers = await Promise.all(users.asUsers.map(user => this.client.getUserWrapper(user))); + const wrappers = await Promise.all(users!.asUsers.map(user => invoker.guild.memberWrapper(user))); return this.client.moderation.handleInfraction(Infraction, invoker, { - targets: wrappers.filter(Boolean) as UserWrapper[], + targets: wrappers.filter(Boolean) as MemberWrapper[], args, data: { roleIds: roles.asRoles.map((r) => r.id), diff --git a/src/client/components/commands/moderation/Unmute.ts b/src/client/components/commands/moderation/Unmute.ts index 4eef1c5..644633e 100644 --- a/src/client/components/commands/moderation/Unmute.ts +++ b/src/client/components/commands/moderation/Unmute.ts @@ -3,7 +3,7 @@ import DiscordClient from '../../../DiscordClient.js'; import { Unmute } from '../../../infractions/index.js'; import { CommandError, ModerationCommand } from '../../../interfaces/index.js'; import InvokerWrapper from '../../wrappers/InvokerWrapper.js'; -import UserWrapper from '../../wrappers/UserWrapper.js'; +import MemberWrapper from '../../wrappers/MemberWrapper.js'; class UnmuteCommand extends ModerationCommand { @@ -22,7 +22,7 @@ class UnmuteCommand extends ModerationCommand }); } - async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) + async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) { if (!users) throw new CommandError(invoker, { index: 'MODERATION_MISSING_USERS' }); @@ -35,9 +35,9 @@ class UnmuteCommand extends ModerationCommand else if (!me!.permissions.has('ManageRoles')) throw new CommandError(invoker, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', formatParams: { command: this.name, missing: 'ManageRoles' } }); - const wrappers = await Promise.all(users.asUsers.map(user => this.client.getUserWrapper(user))); + const wrappers = await Promise.all(users!.asUsers.map(user => invoker.guild.memberWrapper(user))); return this.client.moderation.handleInfraction(Unmute, invoker, { - targets: wrappers.filter(Boolean) as UserWrapper[], + targets: wrappers.filter(Boolean) as MemberWrapper[], args }); } diff --git a/src/client/components/commands/moderation/Vckick.ts b/src/client/components/commands/moderation/Vckick.ts new file mode 100644 index 0000000..d523cf3 --- /dev/null +++ b/src/client/components/commands/moderation/Vckick.ts @@ -0,0 +1,34 @@ +import { CommandParams } from '../../../../../@types/Client.js'; +import DiscordClient from '../../../DiscordClient.js'; +import { VcKick } from '../../../infractions/index.js'; +import { ModerationCommand } from '../../../interfaces/index.js'; +import InvokerWrapper from '../../wrappers/InvokerWrapper.js'; +import MemberWrapper from '../../wrappers/MemberWrapper.js'; + +class VcKickCommand extends ModerationCommand +{ + constructor (client: DiscordClient) + { + super(client, { + name: 'vckick', + description: 'Kick people from a VC.', + moduleName: 'moderation', + options: [], + guildOnly: true, + showUsage: true, + memberPermissions: [ 'MoveMembers' ], + clientPermissions: [ 'MoveMembers' ], + }); + } + + async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams) + { + const wrappers = await Promise.all(users!.asUsers.map(user => invoker.guild.memberWrapper(user))); + return this.client.moderation.handleInfraction(VcKick, invoker, { + targets: wrappers.filter(Boolean) as MemberWrapper[], + args + }); + } +} + +export default VcKickCommand; \ No newline at end of file