From a356047e69f345518619a9a21fb27b1c543efc41 Mon Sep 17 00:00:00 2001 From: Ar Rakin Date: Tue, 1 Aug 2023 23:56:16 +0600 Subject: [PATCH 1/3] fix: bean and shot creation --- src/services/InfractionManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/InfractionManager.ts b/src/services/InfractionManager.ts index c36c041d5..c4d0a85d5 100644 --- a/src/services/InfractionManager.ts +++ b/src/services/InfractionManager.ts @@ -326,7 +326,7 @@ export default class InfractionManager extends Service { return id; } - async createUserBean(user: User, { guild, reason, moderator }: Omit) { + async createUserShot(user: User, { guild, reason, moderator }: Omit) { const id = Math.round(Math.random() * 1000); await this.sendDM(user, guild, { @@ -345,7 +345,7 @@ export default class InfractionManager extends Service { return id; } - async createUserShot(user: User, { guild, moderator, reason }: Pick) { + async createUserBean(user: User, { guild, moderator, reason }: Pick) { const { id } = await this.client.prisma.infraction.create({ data: { type: InfractionType.BEAN, From 13532ba48428c91d4eca16aa87a9c17f2d27171d Mon Sep 17 00:00:00 2001 From: Ar Rakin Date: Tue, 1 Aug 2023 23:59:57 +0600 Subject: [PATCH 2/3] fix: eval command showing backticks when there's no output --- src/commands/settings/EvalCommand.ts | 71 +++++++++++++++------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/src/commands/settings/EvalCommand.ts b/src/commands/settings/EvalCommand.ts index 897fa97e5..322b1844d 100644 --- a/src/commands/settings/EvalCommand.ts +++ b/src/commands/settings/EvalCommand.ts @@ -1,21 +1,21 @@ /** -* This file is part of SudoBot. -* -* Copyright (C) 2021-2023 OSN Developers. -* -* SudoBot is free software; you can redistribute it and/or modify it -* under the terms of the GNU Affero General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* SudoBot is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with SudoBot. If not, see . -*/ + * This file is part of SudoBot. + * + * Copyright (C) 2021-2023 OSN Developers. + * + * SudoBot is free software; you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SudoBot is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with SudoBot. If not, see . + */ import { SlashCommandBuilder, escapeCodeBlock, escapeMarkdown } from "discord.js"; import Command, { AnyCommandContext, ArgumentType, CommandMessage, CommandReturn, ValidationRule } from "../../core/Command"; @@ -28,7 +28,7 @@ export default class EvalCommand extends Command { types: [ArgumentType.StringRest], optional: false, name: "code", - requiredErrorMessage: "You must provide expression(s) to evaluate!", + requiredErrorMessage: "You must provide expression(s) to evaluate!" } ]; public readonly systemAdminOnly = true; @@ -36,14 +36,13 @@ export default class EvalCommand extends Command { public readonly description = "Execute JavaScript code."; public readonly detailedDscription = "This command executes arbitrary JavaScript code. Must be used with caution."; - public readonly argumentSyntaxes = [ - "<...Code>", - ]; + public readonly argumentSyntaxes = ["<...Code>"]; public readonly botRequiredPermissions = []; - public readonly slashCommandBuilder = new SlashCommandBuilder() - .addStringOption(option => option.setName('code').setDescription("The code to execute").setRequired(true)); + public readonly slashCommandBuilder = new SlashCommandBuilder().addStringOption(option => + option.setName("code").setDescription("The code to execute").setRequired(true) + ); createUncaughtExecptionHandler(message: CommandMessage) { return (e: Error) => { @@ -53,7 +52,7 @@ export default class EvalCommand extends Command { this.deferredReply(message, { embeds: [ { - description: `${this.emoji('error')} **Exception occurred**\n\n\`\`\`\n${escapeMarkdown(e.message + "\n" + e.stack)}\n\`\`\``, + description: `${this.emoji("error")} **Exception occurred**\n\n\`\`\`\n${escapeMarkdown(e.message + "\n" + e.stack)}\n\`\`\``, color: 0xf14a60 } ] @@ -69,7 +68,11 @@ export default class EvalCommand extends Command { this.deferredReply(message, { embeds: [ { - description: `${this.emoji('error')} **Unhandled promise rejection**\n\n\`\`\`\n${typeof e === 'string' || typeof (e as any)?.toString === 'function' ? escapeCodeBlock((e as any)?.toString ? (e as any).toString() : (e as any)) : e}\n\`\`\``, + description: `${this.emoji("error")} **Unhandled promise rejection**\n\n\`\`\`\n${ + typeof e === "string" || typeof (e as any)?.toString === "function" + ? escapeCodeBlock((e as any)?.toString ? (e as any).toString() : (e as any)) + : e + }\n\`\`\``, color: 0xf14a60 } ] @@ -91,26 +94,30 @@ export default class EvalCommand extends Command { try { const result = eval(code); + const string = `${ + typeof result === "string" || typeof result?.toString === "function" + ? escapeCodeBlock((result as any)?.toString ? (result as any).toString() : (result as any)) + : result + }`; if (!this.errorOccurred) { this.deferredReply(message, { embeds: [ { - description: `${this.emoji('check')} **Execution succeeded**\n\n\`\`\`${typeof result === 'string' || typeof result?.toString === 'function' ? escapeCodeBlock((result as any)?.toString ? (result as any).toString() : (result as any)) : result}\`\`\``, + description: `${this.emoji("check")} **Execution succeeded**\n\n${ + string.trim() === "" ? "*No output*" : `\`\`\`${string}\`\`\`` + }`, color: 0x007bff } ] }); } - } - catch (e) { + } catch (e) { logError("Evaluation failed"); logError(e); - if ("stack" in (e as any) && "message" in (e as any)) - exceptionHandler(e as any); - else - rejectionHandler(e); + if ("stack" in (e as any) && "message" in (e as any)) exceptionHandler(e as any); + else rejectionHandler(e); } process.off("uncaughtExceptionMonitor", exceptionHandler); From e085afd5105a5dad4929a0d39a750e2158a7a8a8 Mon Sep 17 00:00:00 2001 From: Conventional Release Action Date: Tue, 1 Aug 2023 18:00:40 +0000 Subject: [PATCH 3/3] chore(release): v5.19.1 [skip ci] --- CHANGELOG.md | 19 ++++++++++--------- package.json | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bf9b49ac..50bdfda80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [5.19.1](https://github.com/onesoft-sudo/sudobot/compare/v5.19.0...v5.19.1) (2023-08-01) + + +### Bug Fixes + +* bean and shot creation ([a356047](https://github.com/onesoft-sudo/sudobot/commit/a356047e69f345518619a9a21fb27b1c543efc41)) +* eval command showing backticks when there's no output ([13532ba](https://github.com/onesoft-sudo/sudobot/commit/13532ba48428c91d4eca16aa87a9c17f2d27171d)) + + + # [5.19.0](https://github.com/onesoft-sudo/sudobot/compare/v5.18.0...v5.19.0) (2023-08-01) @@ -36,12 +46,3 @@ -# [5.16.0](https://github.com/onesoft-sudo/sudobot/compare/v5.15.0...v5.16.0) (2023-07-31) - - -### Features - -* **permissionManager:** level based permission system ([96387dc](https://github.com/onesoft-sudo/sudobot/commit/96387dc2aa985bc1c9a0980b55e9b17458553029)) - - - diff --git a/package.json b/package.json index 7d27db756..3b0c77dd9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sudobot", "description": "A Discord bot for moderation purposes.", - "version": "5.19.0", + "version": "5.19.1", "main": "build/index.js", "license": "GPL-3.0-or-later", "keywords": [