feat: added ban/unban reasons to their respective api calls

This commit is contained in:
almeidx 2020-07-27 18:29:30 +01:00
parent 140ba84544
commit d4f12ca1c8
5 changed files with 6 additions and 7 deletions

View file

@ -64,7 +64,7 @@ export const ForcebanCmd = modActionsCommand({
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);
try {
await pluginData.guild.banMember(user.id, 1);
await pluginData.guild.banMember(user.id, 1, reason);
} catch (e) {
sendErrorMessage(pluginData, msg.channel, "Failed to forceban member");
return;

View file

@ -66,7 +66,7 @@ export const MassbanCmd = modActionsCommand({
const casesPlugin = pluginData.getPlugin(CasesPlugin);
for (const userId of args.userIds) {
try {
await pluginData.guild.banMember(userId, 1);
await pluginData.guild.banMember(userId, 1, banReason);
await casesPlugin.createCase({
userId,

View file

@ -42,17 +42,16 @@ export const UnbanCmd = modActionsCommand({
}
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
try {
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
await pluginData.guild.unbanMember(user.id);
await pluginData.guild.unbanMember(user.id, reason);
} catch (e) {
sendErrorMessage(pluginData, msg.channel, "Failed to unban member; are you sure they're banned?");
return;
}
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
// Create a case
const casesPlugin = pluginData.getPlugin(CasesPlugin);
const createdCase = await casesPlugin.createCase({

View file

@ -88,7 +88,7 @@ export async function actualKickMemberCmd(
ignoreEvent(pluginData, IgnoredEventType.Unban, memberToKick.id);
try {
await pluginData.guild.unbanMember(memberToKick.id);
await pluginData.guild.unbanMember(memberToKick.id, reason);
} catch (e) {
sendErrorMessage(pluginData, msg.channel, "Failed to unban the user after banning them (-clean)");
}

View file

@ -40,7 +40,7 @@ export async function banUserId(
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
try {
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
await pluginData.guild.banMember(userId, deleteMessageDays);
await pluginData.guild.banMember(userId, deleteMessageDays, reason);
} catch (e) {
return {
status: "failed",