feat: added ban/unban reasons to their respective api calls
This commit is contained in:
parent
140ba84544
commit
d4f12ca1c8
5 changed files with 6 additions and 7 deletions
|
@ -64,7 +64,7 @@ export const ForcebanCmd = modActionsCommand({
|
||||||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);
|
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await pluginData.guild.banMember(user.id, 1);
|
await pluginData.guild.banMember(user.id, 1, reason);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sendErrorMessage(pluginData, msg.channel, "Failed to forceban member");
|
sendErrorMessage(pluginData, msg.channel, "Failed to forceban member");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -66,7 +66,7 @@ export const MassbanCmd = modActionsCommand({
|
||||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||||
for (const userId of args.userIds) {
|
for (const userId of args.userIds) {
|
||||||
try {
|
try {
|
||||||
await pluginData.guild.banMember(userId, 1);
|
await pluginData.guild.banMember(userId, 1, banReason);
|
||||||
|
|
||||||
await casesPlugin.createCase({
|
await casesPlugin.createCase({
|
||||||
userId,
|
userId,
|
||||||
|
|
|
@ -42,17 +42,16 @@ export const UnbanCmd = modActionsCommand({
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
|
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
|
||||||
|
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
||||||
await pluginData.guild.unbanMember(user.id);
|
await pluginData.guild.unbanMember(user.id, reason);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sendErrorMessage(pluginData, msg.channel, "Failed to unban member; are you sure they're banned?");
|
sendErrorMessage(pluginData, msg.channel, "Failed to unban member; are you sure they're banned?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
|
|
||||||
|
|
||||||
// Create a case
|
// Create a case
|
||||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||||
const createdCase = await casesPlugin.createCase({
|
const createdCase = await casesPlugin.createCase({
|
||||||
|
|
|
@ -88,7 +88,7 @@ export async function actualKickMemberCmd(
|
||||||
ignoreEvent(pluginData, IgnoredEventType.Unban, memberToKick.id);
|
ignoreEvent(pluginData, IgnoredEventType.Unban, memberToKick.id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await pluginData.guild.unbanMember(memberToKick.id);
|
await pluginData.guild.unbanMember(memberToKick.id, reason);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sendErrorMessage(pluginData, msg.channel, "Failed to unban the user after banning them (-clean)");
|
sendErrorMessage(pluginData, msg.channel, "Failed to unban the user after banning them (-clean)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export async function banUserId(
|
||||||
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
|
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
|
||||||
try {
|
try {
|
||||||
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
|
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) {
|
} catch (e) {
|
||||||
return {
|
return {
|
||||||
status: "failed",
|
status: "failed",
|
||||||
|
|
Loading…
Add table
Reference in a new issue