3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-25 18:25:03 +00:00

Merge branch 'master' of https://github.com/Ibotmealot/ZeppelinBot into mod_actions-reason-aliases

This commit is contained in:
Ibotmealot 2022-02-27 19:57:00 -05:00
commit 882e79d171
13 changed files with 55 additions and 24 deletions

View file

@ -25,7 +25,7 @@ export const BanAction = automodAction({
const reason = actionConfig.reason || "Kicked automatically";
const duration = actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : undefined;
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
const deleteMessageDays = actionConfig.deleteMessageDays || undefined;
const deleteMessageDays = actionConfig.deleteMessageDays ?? undefined;
const caseArgs: Partial<CaseArgs> = {
modId: pluginData.client.user!.id,

View file

@ -4,6 +4,8 @@ import { LogType } from "../../../data/LogType";
import { noop } from "../../../utils";
import { automodAction } from "../helpers";
const cleanDebugServer = process.env.TEMP_CLEAN_DEBUG_SERVER;
export const CleanAction = automodAction({
configType: t.boolean,
defaultConfig: false,
@ -27,13 +29,26 @@ export const CleanAction = automodAction({
}
}
if (pluginData.guild.id === cleanDebugServer) {
const toDeleteFormatted = Array.from(messageIdsToDeleteByChannelId.entries())
.map(([channelId, messageIds]) => `- ${channelId}: ${messageIds.join(", ")}`)
.join("\n");
// tslint:disable-next-line:no-console
console.log(`[DEBUG] Cleaning messages (${ruleName}):\n${toDeleteFormatted}`);
}
for (const [channelId, messageIds] of messageIdsToDeleteByChannelId.entries()) {
for (const id of messageIds) {
pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id);
}
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake) as TextChannel;
await channel.bulkDelete(messageIds as Snowflake[]).catch(noop);
await channel.bulkDelete(messageIds as Snowflake[]).catch((err) => {
if (pluginData.guild.id === cleanDebugServer) {
// tslint:disable-next-line:no-console
console.error(`[DEBUG] Failed to bulk delete messages (${ruleName}): ${err}`);
}
});
}
},
});

View file

@ -17,6 +17,7 @@ import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { automodAction } from "../helpers";
import { AutomodContext } from "../types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
export const ReplyAction = automodAction({
configType: t.union([
@ -109,6 +110,10 @@ export const ReplyAction = automodAction({
};
}
if (messageIsEmpty(messageOpts)) {
return;
}
const replyMsg = await channel.send(messageOpts);
if (typeof actionConfig === "object" && actionConfig.auto_delete) {

View file

@ -1,13 +1,13 @@
import { CaseTypes } from "../../data/CaseTypes";
export const caseIcons: Record<CaseTypes, string> = {
[CaseTypes.Ban]: "<:case_ban:742540201443721317>",
[CaseTypes.Unban]: "<:case_unban:742540201670475846>",
[CaseTypes.Note]: "<:case_note:742540201368485950>",
[CaseTypes.Warn]: "<:case_warn:742540201624338454>",
[CaseTypes.Kick]: "<:case_kick:742540201661825165>",
[CaseTypes.Mute]: "<:case_mute:742540201817145364>",
[CaseTypes.Unmute]: "<:case_unmute:742540201489858643>",
[CaseTypes.Deleted]: "<:case_deleted:742540201473343529>",
[CaseTypes.Softban]: "<:case_softban:742540201766813747>",
[CaseTypes.Ban]: "<:case_ban:906897178176393246>",
[CaseTypes.Unban]: "<:case_unban:906897177824067665>",
[CaseTypes.Note]: "<:case_note:906897177832476743>",
[CaseTypes.Warn]: "<:case_warn:906897177840844832>",
[CaseTypes.Kick]: "<:case_kick:906897178310639646>",
[CaseTypes.Mute]: "<:case_mute:906897178147057664>",
[CaseTypes.Unmute]: "<:case_unmute:906897177819881523>",
[CaseTypes.Deleted]: "<:case_deleted:906897178209968148>",
[CaseTypes.Softban]: "<:case_softban:906897177828278274>",
};

View file

@ -87,7 +87,7 @@ export async function banUserId(
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, userId);
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
try {
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
const deleteMessageDays = Math.min(7, Math.max(0, banOptions.deleteMessageDays ?? 1));
await pluginData.guild.bans.create(userId as Snowflake, {
days: deleteMessageDays,
reason: reason ?? undefined,

View file

@ -23,7 +23,7 @@ const defaultOptions: PluginOptions<NameHistoryPluginType> = {
export const NameHistoryPlugin = zeppelinGuildPlugin<NameHistoryPluginType>()({
name: "name_history",
showInDocs: false,
showInDocs: true,
configSchema: ConfigSchema,
defaultOptions,
@ -35,9 +35,8 @@ export const NameHistoryPlugin = zeppelinGuildPlugin<NameHistoryPluginType>()({
// prettier-ignore
events: [
// FIXME: Temporary
// ChannelJoinEvt,
// MessageCreateEvt,
ChannelJoinEvt,
MessageCreateEvt,
],
beforeLoad(pluginData) {

View file

@ -117,13 +117,13 @@ export const ReactionRolesPlugin = zeppelinGuildPlugin<ReactionRolesPluginType>(
RefreshReactionRolesCmd,
ClearReactionRolesCmd,
InitReactionRolesCmd,
// PostButtonRolesCmd,
PostButtonRolesCmd,
],
// prettier-ignore
events: [
AddReactionRoleEvt,
// ButtonInteractionEvt,
ButtonInteractionEvt,
MessageDeletedEvt,
],
configPreprocessor,

View file

@ -63,7 +63,7 @@ export const HelpCmd = utilityCmd({
let snippet = `**${prefix}${trigger}**`;
if (description) snippet += `\n${description}`;
if (usage) snippet += `\nBasic usage: \`${usage}\``;
snippet += `\n<https://zeppelin.gg/docs/plugins/${plugin.blueprint.name}/usage#command-${commandSlug}>`;
snippet += `\n<https://zeppelin-dashboard.up.railway.app/docs/plugins/${plugin.blueprint.name}/usage#command-${commandSlug}>`;
return snippet;
});

View file

@ -130,9 +130,10 @@ export async function getMessageInfoEmbed(
}
if (message.attachments.size) {
const attachmentUrls = message.attachments.map((att) => att.url);
embed.fields.push({
name: preEmbedPadding + "Attachments",
value: message.attachments[0].url,
value: attachmentUrls.join("\n"),
});
}