Don't send null/undefined as audit log reasons
This commit is contained in:
parent
b2a67523a1
commit
ceb567ad9a
4 changed files with 8 additions and 4 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, encodeURIComponent(reason));
|
await pluginData.guild.banMember(user.id, 1, reason != null ? encodeURIComponent(reason) : undefined);
|
||||||
} 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, encodeURIComponent(banReason));
|
await pluginData.guild.banMember(userId, 1, banReason != null ? encodeURIComponent(banReason) : undefined);
|
||||||
|
|
||||||
await casesPlugin.createCase({
|
await casesPlugin.createCase({
|
||||||
userId,
|
userId,
|
||||||
|
|
|
@ -46,7 +46,7 @@ export const UnbanCmd = modActionsCommand({
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
||||||
await pluginData.guild.unbanMember(user.id, encodeURIComponent(reason));
|
await pluginData.guild.unbanMember(user.id, reason != null ? encodeURIComponent(reason) : undefined);
|
||||||
} 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;
|
||||||
|
|
|
@ -40,7 +40,11 @@ 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, encodeURIComponent(reason));
|
await pluginData.guild.banMember(
|
||||||
|
userId,
|
||||||
|
deleteMessageDays,
|
||||||
|
reason != null ? encodeURIComponent(reason) : undefined,
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return {
|
return {
|
||||||
status: "failed",
|
status: "failed",
|
||||||
|
|
Loading…
Add table
Reference in a new issue