From 07bdb4b7225cc6352ea1a387d35750d5637e42d4 Mon Sep 17 00:00:00 2001 From: Doggles <83906328+Doggles@users.noreply.github.com> Date: Sun, 9 May 2021 13:28:07 +0100 Subject: [PATCH 01/12] Update PingCmd.ts --- backend/src/plugins/Utility/commands/PingCmd.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/plugins/Utility/commands/PingCmd.ts b/backend/src/plugins/Utility/commands/PingCmd.ts index b8304182..e702f44f 100644 --- a/backend/src/plugins/Utility/commands/PingCmd.ts +++ b/backend/src/plugins/Utility/commands/PingCmd.ts @@ -5,7 +5,7 @@ import { Message } from "eris"; const { performance } = require("perf_hooks"); export const PingCmd = utilityCmd({ - trigger: "ping", + trigger: ["ping", "pong"], description: "Test the bot's ping to the Discord API", permission: "can_ping", From b210b2b91fe2054e9ea849fdc001eaf3cd7528c5 Mon Sep 17 00:00:00 2001 From: Shoaib Sajid Date: Wed, 26 May 2021 00:37:38 +0500 Subject: [PATCH 02/12] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1d29e514..02eae9ee 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ These instructions are intended for bot development only. Configuration is stored in the database in the `configs` table ```yml +prefix: '!' + # role id: level levels: "12345678": 100 # Example admin From b820697537ea3958bf852e42a7e8c17349b8feef Mon Sep 17 00:00:00 2001 From: Shoaib Sajid Date: Mon, 21 Jun 2021 20:41:37 +0500 Subject: [PATCH 03/12] Update Counters.vue --- dashboard/src/components/docs/Counters.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dashboard/src/components/docs/Counters.vue b/dashboard/src/components/docs/Counters.vue index 0a874b46..663a3968 100644 --- a/dashboard/src/components/docs/Counters.vue +++ b/dashboard/src/components/docs/Counters.vue @@ -321,7 +321,7 @@ actions: set_counter: counter: "antiraid_decay" - amount: 10 # "Disable after 10min" + value: 10 # "Disable after 10min" start_antiraid_timer_high: triggers: @@ -330,7 +330,7 @@ actions: set_counter: counter: "antiraid_decay" - amount: 20 # "Disable after 20min" + value: 20 # "Disable after 20min" disable_antiraid_after_timer: triggers: From a9b0902a017d80bb7c2775dc657b03b7fb673252 Mon Sep 17 00:00:00 2001 From: Almeida Date: Mon, 10 May 2021 12:23:57 +0100 Subject: [PATCH 04/12] added support for emoji ids on emojiinfo command --- .../plugins/Utility/commands/EmojiInfoCmd.ts | 8 +++---- .../src/plugins/Utility/commands/InfoCmd.ts | 22 +++++++------------ .../Utility/functions/getCustomEmojiId.ts | 6 +++++ 3 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 backend/src/plugins/Utility/functions/getCustomEmojiId.ts diff --git a/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts b/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts index 3f7d094b..b863b344 100644 --- a/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts @@ -1,7 +1,7 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage } from "../../../pluginUtils"; -import { customEmojiRegex } from "../../../utils"; import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed"; +import { getCustomEmojiId } from "../functions/getCustomEmojiId"; import { utilityCmd } from "../types"; export const EmojiInfoCmd = utilityCmd({ @@ -15,13 +15,13 @@ export const EmojiInfoCmd = utilityCmd({ }, async run({ message, args, pluginData }) { - const emojiIdMatch = args.emoji.match(customEmojiRegex); - if (!emojiIdMatch?.[2]) { + const emojiId = getCustomEmojiId(args.emoji); + if (!emojiId) { sendErrorMessage(pluginData, message.channel, "Emoji not found"); return; } - const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]); + const embed = await getEmojiInfoEmbed(pluginData, emojiId); if (!embed) { sendErrorMessage(pluginData, message.channel, "Emoji not found"); return; diff --git a/backend/src/plugins/Utility/commands/InfoCmd.ts b/backend/src/plugins/Utility/commands/InfoCmd.ts index 9c4b55d3..5dcf3456 100644 --- a/backend/src/plugins/Utility/commands/InfoCmd.ts +++ b/backend/src/plugins/Utility/commands/InfoCmd.ts @@ -2,26 +2,20 @@ import { Snowflake } from "discord.js"; import { getChannelId, getRoleId } from "knub/dist/utils"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage } from "../../../pluginUtils"; -import { - customEmojiRegex, - isValidSnowflake, - noop, - parseInviteCodeInput, - resolveInvite, - resolveUser, -} from "../../../utils"; +import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils"; +import { getUserInfoEmbed } from "../functions/getUserInfoEmbed"; import { canReadChannel } from "../../../utils/canReadChannel"; import { resolveMessageTarget } from "../../../utils/resolveMessageTarget"; import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed"; -import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed"; import { getGuildPreview } from "../functions/getGuildPreview"; import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed"; import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed"; import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed"; +import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed"; +import { getCustomEmojiId } from "../functions/getCustomEmojiId"; +import { utilityCmd } from "../types"; import { getServerInfoEmbed } from "../functions/getServerInfoEmbed"; import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed"; -import { getUserInfoEmbed } from "../functions/getUserInfoEmbed"; -import { utilityCmd } from "../types"; export const InfoCmd = utilityCmd({ trigger: "info", @@ -139,9 +133,9 @@ export const InfoCmd = utilityCmd({ // 8. Emoji if (userCfg.can_emojiinfo) { - const emojiIdMatch = value.match(customEmojiRegex); - if (emojiIdMatch?.[2]) { - const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]); + const emojiId = getCustomEmojiId(value); + if (emojiId) { + const embed = await getEmojiInfoEmbed(pluginData, emojiId); if (embed) { message.channel.send({ embeds: [embed] }); return; diff --git a/backend/src/plugins/Utility/functions/getCustomEmojiId.ts b/backend/src/plugins/Utility/functions/getCustomEmojiId.ts new file mode 100644 index 00000000..3fdce097 --- /dev/null +++ b/backend/src/plugins/Utility/functions/getCustomEmojiId.ts @@ -0,0 +1,6 @@ +const customEmojiRegex = /(?:?/i; + +export function getCustomEmojiId(str: string): string | null { + const emojiIdMatch = str.match(customEmojiRegex); + return emojiIdMatch?.[1] ?? null; +} From ac67342e43ce70e78a30ee6aeb7e0abefaffbcde Mon Sep 17 00:00:00 2001 From: Almeida Date: Sun, 9 May 2021 21:43:09 +0100 Subject: [PATCH 05/12] made RoleAddCmd and RoleRemoveCmd mention the command author --- backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts | 4 +++- .../src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts index 0568ea41..45345c78 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts @@ -43,6 +43,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, + { users: true }, ); lock.unlock(); return; @@ -87,6 +88,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to grant you the roles`, + { users: true }, ); return; } @@ -118,7 +120,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ messageParts.push("couldn't recognize some of the roles"); } - sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`); + sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, { users: true }); lock.unlock(); }, diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts index 0ba51766..1a896e1e 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts @@ -51,12 +51,14 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` + ` couldn't recognize the other roles you mentioned`, + { users: true }, ); } else { sendSuccessMessage( pluginData, msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, + { users: true }, ); } } catch { @@ -64,6 +66,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to remove the roles`, + { users: true }, ); } } else { @@ -71,6 +74,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, + { users: true }, ); } From b38eeeab4275c7346d20da48702910dbdaf08c47 Mon Sep 17 00:00:00 2001 From: almeidx Date: Sat, 14 Aug 2021 14:54:18 +0100 Subject: [PATCH 06/12] update for discord.js --- .../src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts | 8 +++++--- .../plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts index 45345c78..8fa9cca4 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts @@ -43,7 +43,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, - { users: true }, + { users: [msg.author.id] }, ); lock.unlock(); return; @@ -88,7 +88,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to grant you the roles`, - { users: true }, + { users: [msg.author.id] }, ); return; } @@ -120,7 +120,9 @@ export const RoleAddCmd = selfGrantableRolesCmd({ messageParts.push("couldn't recognize some of the roles"); } - sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, { users: true }); + sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, { + users: [msg.author.id], + }); lock.unlock(); }, diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts index 1a896e1e..7a4bb83b 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts @@ -51,14 +51,14 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` + ` couldn't recognize the other roles you mentioned`, - { users: true }, + { users: [msg.author.id] }, ); } else { sendSuccessMessage( pluginData, msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, - { users: true }, + { users: [msg.author.id] }, ); } } catch { @@ -66,7 +66,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to remove the roles`, - { users: true }, + { users: [msg.author.id] }, ); } } else { @@ -74,7 +74,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, - { users: true }, + { users: [msg.author.id] }, ); } From 5b1a2ca7a376b5bb03daea08466a42112e027800 Mon Sep 17 00:00:00 2001 From: Almeida Date: Fri, 7 May 2021 21:21:51 +0100 Subject: [PATCH 07/12] added legacy plugins section --- backend/src/api/docs.ts | 2 +- backend/src/plugins/Censor/CensorPlugin.ts | 1 + backend/src/plugins/Spam/SpamPlugin.ts | 1 + .../src/plugins/ZeppelinPluginBlueprint.ts | 1 + backend/src/types.ts | 1 + dashboard/src/components/docs/DocsLayout.vue | 243 ++++++++++-------- 6 files changed, 137 insertions(+), 112 deletions(-) diff --git a/backend/src/api/docs.ts b/backend/src/api/docs.ts index 3009a4e1..8dbeb116 100644 --- a/backend/src/api/docs.ts +++ b/backend/src/api/docs.ts @@ -37,7 +37,7 @@ export function initDocs(app: express.Express) { app.get("/docs/plugins", (req: express.Request, res: express.Response) => { res.json( docsPlugins.map(plugin => { - const thinInfo = plugin.info ? { prettyName: plugin.info.prettyName } : {}; + const thinInfo = plugin.info ? { prettyName: plugin.info.prettyName, legacy: plugin.info.legacy ?? false } : {}; return { name: plugin.name, info: thinInfo, diff --git a/backend/src/plugins/Censor/CensorPlugin.ts b/backend/src/plugins/Censor/CensorPlugin.ts index f8401f54..27f8ed9f 100644 --- a/backend/src/plugins/Censor/CensorPlugin.ts +++ b/backend/src/plugins/Censor/CensorPlugin.ts @@ -52,6 +52,7 @@ export const CensorPlugin = zeppelinGuildPlugin()({ Censor words, tokens, links, regex, etc. For more advanced filtering, check out the Automod plugin! `), + legacy: true, }, dependencies: [LogsPlugin], diff --git a/backend/src/plugins/Spam/SpamPlugin.ts b/backend/src/plugins/Spam/SpamPlugin.ts index ddf45a0b..87dc50ad 100644 --- a/backend/src/plugins/Spam/SpamPlugin.ts +++ b/backend/src/plugins/Spam/SpamPlugin.ts @@ -51,6 +51,7 @@ export const SpamPlugin = zeppelinGuildPlugin()({ Basic spam detection and auto-muting. For more advanced spam filtering, check out the Automod plugin! `), + legacy: true, }, dependencies: [LogsPlugin], diff --git a/backend/src/plugins/ZeppelinPluginBlueprint.ts b/backend/src/plugins/ZeppelinPluginBlueprint.ts index 7a1dd44a..9bcd3417 100644 --- a/backend/src/plugins/ZeppelinPluginBlueprint.ts +++ b/backend/src/plugins/ZeppelinPluginBlueprint.ts @@ -27,6 +27,7 @@ export interface ZeppelinGuildPluginBlueprint