From ae85233ae06dbf1e6420636d9ec4c976d841a21c Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 4 Sep 2022 16:38:15 +0100 Subject: [PATCH] Fix changes requested --- package.json | 7 ++++--- src/commands/about.ts | 14 +++++++++++--- src/commands/ban.ts | 9 ++------- src/commands/kick.ts | 9 ++------- src/commands/mute.ts | 9 ++------- src/commands/warn.ts | 9 ++------- src/entity/Server.ts | 1 - 7 files changed, 23 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index aa06b2d..6ca06c5 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,13 @@ }, "repository": { "type": "git", - "url": "https://gitea.vylpes.xyz/rabbitlabs/vylbot-app" + "url": "https://github.com/Vylpes/vylbot-app" }, "author": "Vylpes", "license": "MIT", - "bugs": "https://gitea.vylpes.xyz/rabbitlabs/vylbot-app/issues", - "homepage": "https://gitea.vylpes.xyz/rabbitlabs/vylbot-app", + "bugs": "https://github.com/Vylpes/vylbot-app/issues", + "homepage": "https://github.com/Vylpes/vylbot-app", + "funding": "https://ko-fi.com/vylpes", "dependencies": { "@types/jest": "^27.0.3", "@types/uuid": "^8.3.4", diff --git a/src/commands/about.ts b/src/commands/about.ts index a5f62f4..b688df6 100644 --- a/src/commands/about.ts +++ b/src/commands/about.ts @@ -1,4 +1,4 @@ -import { Emoji, MessageActionRow, MessageButton } from "discord.js"; +import { MessageActionRow, MessageButton } from "discord.js"; import { MessageButtonStyles } from "discord.js/typings/enums"; import { ICommandContext } from "../contracts/ICommandContext"; import PublicEmbed from "../helpers/embeds/PublicEmbed"; @@ -22,11 +22,19 @@ export default class About extends Command { const row = new MessageActionRow(); if (repoLink) { - row.addComponents(new MessageButton().setURL(repoLink).setLabel("Repo").setStyle(MessageButtonStyles.LINK)); + row.addComponents( + new MessageButton() + .setURL(repoLink) + .setLabel("Repo") + .setStyle(MessageButtonStyles.LINK)); } if (fundingLink) { - row.addComponents(new MessageButton().setURL(fundingLink).setLabel("Funding").setStyle(MessageButtonStyles.LINK)); + row.addComponents( + new MessageButton() + .setURL(fundingLink) + .setLabel("Funding") + .setStyle(MessageButtonStyles.LINK)); } await embed.SendToCurrentChannel({ components: [row] }); diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 518b0d2..8d50132 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -7,7 +7,6 @@ import { ICommandContext } from "../contracts/ICommandContext"; import ICommandReturnContext from "../contracts/ICommandReturnContext"; import Audit from "../entity/Audit"; import { AuditType } from "../constants/AuditType"; -import Server from "../entity/Server"; export default class Ban extends Command { constructor() { @@ -79,13 +78,9 @@ export default class Ban extends Command { await publicEmbed.SendToCurrentChannel(); if (context.message.guild) { - const server = await Server.FetchOneById(Server, context.message.guild.id); + const audit = new Audit(targetUser.id, AuditType.Ban, reason, context.message.author.id, context.message.guild.id); - if (server) { - const audit = new Audit(targetUser.id, AuditType.Ban, reason, context.message.author.id, context.message.guild.id); - - await audit.Save(Audit, audit); - } + await audit.Save(Audit, audit); } return { diff --git a/src/commands/kick.ts b/src/commands/kick.ts index 5be4321..c1b2572 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -3,7 +3,6 @@ import ErrorMessages from "../constants/ErrorMessages"; import { ICommandContext } from "../contracts/ICommandContext"; import ICommandReturnContext from "../contracts/ICommandReturnContext"; import Audit from "../entity/Audit"; -import Server from "../entity/Server"; import ErrorEmbed from "../helpers/embeds/ErrorEmbed"; import LogEmbed from "../helpers/embeds/LogEmbed"; import PublicEmbed from "../helpers/embeds/PublicEmbed"; @@ -79,13 +78,9 @@ export default class Kick extends Command { await publicEmbed.SendToCurrentChannel(); if (context.message.guild) { - const server = await Server.FetchOneById(Server, context.message.guild.id); + const audit = new Audit(targetUser.id, AuditType.Kick, reason, context.message.author.id, context.message.guild.id); - if (server) { - const audit = new Audit(targetUser.id, AuditType.Kick, reason, context.message.author.id, context.message.guild.id); - - await audit.Save(Audit, audit); - } + await audit.Save(Audit, audit); } return { diff --git a/src/commands/mute.ts b/src/commands/mute.ts index 8e01eea..7a45b87 100644 --- a/src/commands/mute.ts +++ b/src/commands/mute.ts @@ -3,7 +3,6 @@ import ErrorMessages from "../constants/ErrorMessages"; import { ICommandContext } from "../contracts/ICommandContext"; import ICommandReturnContext from "../contracts/ICommandReturnContext"; import Audit from "../entity/Audit"; -import Server from "../entity/Server"; import ErrorEmbed from "../helpers/embeds/ErrorEmbed"; import LogEmbed from "../helpers/embeds/LogEmbed"; import PublicEmbed from "../helpers/embeds/PublicEmbed"; @@ -92,13 +91,9 @@ export default class Mute extends Command { await publicEmbed.SendToCurrentChannel(); if (context.message.guild) { - const server = await Server.FetchOneById(Server, context.message.guild.id); + const audit = new Audit(targetUser.id, AuditType.Mute, reason, context.message.author.id, context.message.guild.id); - if (server) { - const audit = new Audit(targetUser.id, AuditType.Mute, reason, context.message.author.id, context.message.guild.id); - - await audit.Save(Audit, audit); - } + await audit.Save(Audit, audit); } return { diff --git a/src/commands/warn.ts b/src/commands/warn.ts index dbc70c0..00f9efe 100644 --- a/src/commands/warn.ts +++ b/src/commands/warn.ts @@ -2,7 +2,6 @@ import { AuditType } from "../constants/AuditType"; import { ICommandContext } from "../contracts/ICommandContext"; import ICommandReturnContext from "../contracts/ICommandReturnContext"; import Audit from "../entity/Audit"; -import Server from "../entity/Server"; import ErrorEmbed from "../helpers/embeds/ErrorEmbed"; import LogEmbed from "../helpers/embeds/LogEmbed"; import PublicEmbed from "../helpers/embeds/PublicEmbed"; @@ -67,13 +66,9 @@ export default class Warn extends Command { await publicEmbed.SendToCurrentChannel(); if (context.message.guild) { - const server = await Server.FetchOneById(Server, context.message.guild.id); + const audit = new Audit(user.id, AuditType.Warn, reason, context.message.author.id, context.message.guild.id); - if (server) { - const audit = new Audit(user.id, AuditType.Warn, reason, context.message.author.id, context.message.guild.id); - - await audit.Save(Audit, audit); - } + await audit.Save(Audit, audit); } return { diff --git a/src/entity/Server.ts b/src/entity/Server.ts index bd0b1e9..f669e58 100644 --- a/src/entity/Server.ts +++ b/src/entity/Server.ts @@ -1,6 +1,5 @@ import { Entity, OneToMany } from "typeorm"; import BaseEntity from "../contracts/BaseEntity"; -import Audit from "./Audit"; import Role from "./Role"; import Setting from "./Setting";