From 9f8976cd072c56f802384615478b502c9044df8b Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Sun, 14 Jan 2024 19:06:27 +1100 Subject: [PATCH] Remove unused command --- src/client.ts | 3 +- src/commands/bonk.ts | 27 ---------------- src/commands/{reminder.ts => remind.ts} | 4 +-- src/models/IMPORTS.ts | 1 - src/models/bonkCount.ts | 43 ------------------------- 5 files changed, 3 insertions(+), 75 deletions(-) delete mode 100644 src/commands/bonk.ts rename src/commands/{reminder.ts => remind.ts} (91%) delete mode 100644 src/models/bonkCount.ts diff --git a/src/client.ts b/src/client.ts index 1cb7054..3060658 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,7 +11,7 @@ import ConfigHelper from './helpers/ConfigHelper.js'; import {readdirSync} from 'node:fs'; import {Config} from 'src/interfaces'; import { - DailyMsgsSvc, UserLevelsSvc, BonkCountSvc, + DailyMsgsSvc, UserLevelsSvc, MPServerSvc, PunishmentsSvc, ProhibitedWordsSvc, SuggestionsSvc, TagSystemSvc, YouTubeChannelsSvc } from './models/IMPORTS.js'; @@ -30,7 +30,6 @@ export default class TClient extends Discord.Client { public dailyMsgs: DailyMsgsSvc = new DailyMsgsSvc(); public userLevels: UserLevelsSvc = new UserLevelsSvc(this); public punishments: PunishmentsSvc = new PunishmentsSvc(this); - public bonkCount: BonkCountSvc = new BonkCountSvc(); public prohibitedWords: ProhibitedWordsSvc = new ProhibitedWordsSvc(); public MPServer: MPServerSvc = new MPServerSvc(); public suggestions: SuggestionsSvc = new SuggestionsSvc(); diff --git a/src/commands/bonk.ts b/src/commands/bonk.ts deleted file mode 100644 index 85c07c2..0000000 --- a/src/commands/bonk.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Discord from 'discord.js'; -import TClient from '../client.js'; -export default class Bonk { - static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ - //if (!client.isStaff(interaction.member) && interaction.channelId == '468835415093411863') return interaction.reply('This command is restricted to staff only in this channel due to high usage.') - const member = interaction.options.getMember('member') as Discord.GuildMember; - const reason = interaction.options.getString('reason'); - if (member.permissions.has('Administrator')) return interaction.reply('You cannot bonk an admin!'); - - await client.bonkCount.hitCountIncremental(member.id); - interaction.reply({embeds: [new client.embed().setColor(client.config.embedColor) - .setDescription(`> <@${member.id}> has been bonked!\n${reason?.length == null ? '' : `> Reason: **${reason}**`}`) - .setImage('https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif') - .setFooter({text: `Bonk count for ${member.displayName}: ${await client.bonkCount.fetchUser(member.id).then(x=>x.count)}`}) - ]}) - } - static data = new Discord.SlashCommandBuilder() - .setName('bonk') - .setDescription('Bonk a member') - .addUserOption(x=>x - .setName('member') - .setDescription('Which member to bonk?') - .setRequired(true)) - .addStringOption(x=>x - .setName('reason') - .setDescription('Reason for the bonk')) -} diff --git a/src/commands/reminder.ts b/src/commands/remind.ts similarity index 91% rename from src/commands/reminder.ts rename to src/commands/remind.ts index 581548b..7e03d40 100644 --- a/src/commands/reminder.ts +++ b/src/commands/remind.ts @@ -1,12 +1,12 @@ import Discord from 'discord.js'; import TClient from '../client.js'; import Punish from '../components/Punish.js'; -export default class Reminder { +export default class Remind { static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ Punish(client, interaction, 'remind'); } static data = new Discord.SlashCommandBuilder() - .setName('reminder') + .setName('remind') .setDescription('Remind a member that they\'re breaking the rules') .addUserOption(x=>x .setName('member') diff --git a/src/models/IMPORTS.ts b/src/models/IMPORTS.ts index ee3a080..124d107 100644 --- a/src/models/IMPORTS.ts +++ b/src/models/IMPORTS.ts @@ -1,6 +1,5 @@ export * from './MPServer.js'; export * from './dailyMsgs.js'; -export * from './bonkCount.js'; export * from './userLevels.js'; export * from './punishments.js'; export * from './prohibitedWords.js'; diff --git a/src/models/bonkCount.ts b/src/models/bonkCount.ts deleted file mode 100644 index 999ab41..0000000 --- a/src/models/bonkCount.ts +++ /dev/null @@ -1,43 +0,0 @@ -import DatabaseServer from '../components/DatabaseServer.js'; -import {Model, DataTypes} from 'sequelize'; - -class bonkCount extends Model { - declare public id: string; - declare public count: number; -} - -export class BonkCountSvc { - private model: typeof bonkCount; - - constructor(){ - this.model = bonkCount; - this.model.init({ - id: { - type: DataTypes.STRING, - unique: true, - primaryKey: true - }, - count: { - type: DataTypes.INTEGER, - allowNull: false, - } - }, { - tableName: 'bonkcount', - createdAt: false, - updatedAt: false, - sequelize: DatabaseServer.seq - }); - this.model.sync(); - } - async hitCountIncremental(userId:string) { - const getUser = await this.model.findByPk(userId); - if (getUser) getUser.increment('count'); - else await this.model.create({id: userId, count: 1}); - return this; - } - async fetchUser(userId:string) { - const getUser = await this.model.findByPk(userId); - if (getUser) return getUser.dataValues; - else return 0; - } -}