Skip to content

Commit

Permalink
Legacy stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Mar 27, 2024
1 parent e5c14f9 commit 5904579
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 188 deletions.
5 changes: 2 additions & 3 deletions src/commands/_commands.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Command } from '../handlers/command.handler';
import { deleteWarningCommand } from './moderation/deletewarning.command';
import { listWarningsCommand } from './moderation/listwarnings.command';
import { warnCommand } from './moderation/warn.command';
import { migrateWarningsCommand } from './moderation/migrate_warnings.command';
import { sayCommand } from './util/say.command';
import { tagCommand, tagCommandTextBased } from './util/tag.command';

export const commands: Command[] = [sayCommand, tagCommand];

if (process.env.NODE_ENV !== 'development') {
commands.push(warnCommand, deleteWarningCommand, listWarningsCommand);
commands.push(migrateWarningsCommand, listWarningsCommand);
}

export default commands;
Expand Down
83 changes: 0 additions & 83 deletions src/commands/moderation/deletewarning.command.ts

This file was deleted.

30 changes: 30 additions & 0 deletions src/commands/moderation/migrate_warnings.command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Command } from '../../handlers/command.handler';
import { PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
import prisma from '../../utils/prisma';

export const migrateWarningsCommand: Command = {
data: new SlashCommandBuilder()
.setName('migrate-warnings')
.setDescription("Migrate warnings to zeppelin")
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers)
.setDMPermission(false),
async execute(interaction) {
if (!interaction.guild) return;

const warnings = await prisma.warning.findMany()

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
for (const warning: {id: string, reason: string, timestamp: Date, issuerId: string, userId: string} in warnings) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const date = Math.floor(new Date(warning.timestamp).getTime() / 1000);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const issuer = await interaction.guild.members.fetch(warning.issuerId).
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
interaction.channel.send(`!note ${warning.userId} ${warning.reason} | Migrated warning, Originally created at <t:${date}>, By ${issuer.username}`)
}
},
};
102 changes: 0 additions & 102 deletions src/commands/moderation/warn.command.ts

This file was deleted.

0 comments on commit 5904579

Please sign in to comment.