1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// import {
// clientSendAndPermCheck,
// CustomCommand,
// emojis,
// ModLog,
// ModLogModel,
// OptArgType,
// userGuildPermCheck,
// type CommandMessage,
// type SlashMessage
// } from '#lib';
// import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
// import { FindOptions, Op } from 'sequelize';
// const punishmentTypes = ['ban', 'kick', 'mute', 'warn', 'role'] as const;
// export default class ActivePunishmentsCommand extends CustomCommand {
// public constructor() {
// super('activePunishments', {
// aliases: ['active-punishments', 'ap'],
// category: 'moderation',
// description: 'Gets a list of all the active punishment in the server.',
// usage: [`active-punishments [--moderator <user>] [--type <${punishmentTypes.map((v) => `'${v}'`).join('|')}>]`],
// examples: ['active-punishments'],
// args: [
// {
// id: 'moderator',
// description: 'Only show active punishments by this moderator.',
// type: 'user',
// match: 'option',
// prompt: 'Only show active punishments from what user?',
// optional: true,
// slashType: ApplicationCommandOptionType.User,
// slashResolve: 'Member'
// },
// {
// id: 'type',
// description: 'Only show active punishments of this type.',
// customType: [...punishmentTypes],
// readableType: punishmentTypes.map((v) => `'${v}'`).join('|'),
// match: 'option',
// optional: true,
// slashType: ApplicationCommandOptionType.String,
// choices: punishmentTypes.map((v) => ({ name: v, value: v }))
// }
// ],
// slash: true,
// channel: 'guild',
// hidden: true,
// clientPermissions: [],
// userPermissions: ['ManageMessages']
// });
// }
// public override async exec(
// message: CommandMessage | SlashMessage,
// args: { moderator: OptArgType<'user' | 'member'>; type: typeof punishmentTypes[number] }
// ) {
// const where: FindOptions<ModLogModel>['where'] = { guild: message.guild!.id };
// if (args.moderator?.id) where.user = args.moderator.id;
// if (args.type) {
// switch (args.type) {
// case 'ban':
// where.type = { [Op.or]: ['PERM_BAN', 'TEMP_BAN', 'UNBAN'] };
// break;
// case 'kick':
// where.type = { [Op.or]: ['KICK'] };
// break;
// case 'mute':
// where.type = { [Op.or]: ['PERM_MUTE', 'TEMP_MUTE', 'UNMUTE'] };
// break;
// case 'warn':
// where.type = { [Op.or]: ['WARN'] };
// break;
// case 'role':
// where.type = { [Op.or]: ['PERM_PUNISHMENT_ROLE', 'TEMP_PUNISHMENT_ROLE', 'REMOVE_PUNISHMENT_ROLE'] };
// break;
// default:
// return message.util.reply(`${emojis.error} You supplied an invalid case type to filter by.`);
// }
// }
// const logs = await ModLog.findAll({
// where,
// order: [['createdAt', 'ASC']]
// });
// }
// }
|