Fixing warn command to use MemberWrapper

This commit is contained in:
D3vision 2023-12-05 22:00:49 +01:00
parent a637f1df22
commit f65604ec2b
9 changed files with 3245 additions and 3243 deletions

View File

@ -7,7 +7,8 @@
"discord": {
"prefix": "!",
"developers": [
"132777808362471424"
"132777808362471424",
"187613017733726210"
],
"developmentMode": true,
"libraryOptions": {
@ -39,7 +40,8 @@
"264527028751958016",
"207880433432657920",
"992757341848080486",
"1069272779100266598"
"1069272779100266598",
"1086433147073331340"
]
}
},

View File

@ -3,7 +3,7 @@ import DiscordClient from '../../../DiscordClient.js';
import { Warn } 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 WarnCommand extends ModerationCommand
{
@ -28,11 +28,11 @@ class WarnCommand extends ModerationCommand
});
}
async execute (invoker: InvokerWrapper, { users, ...args }: CommandParams)
async execute (invoker: InvokerWrapper<true>, { 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(Warn, invoker, {
targets: wrappers.filter(Boolean) as UserWrapper[],
targets: wrappers.filter(Boolean) as MemberWrapper[],
args
});
}