mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 16:30:58 -05:00
Add /reminder moderation command
This commit is contained in:
parent
1884a6bd04
commit
785eb8eaf2
18
src/commands/reminder.ts
Normal file
18
src/commands/reminder.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import Discord from 'discord.js';
|
||||
import TClient from '../client.js';
|
||||
import Punish from '../components/Punish.js';
|
||||
export default class Reminder {
|
||||
static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||
Punish(client, interaction, 'remind');
|
||||
}
|
||||
static data = new Discord.SlashCommandBuilder()
|
||||
.setName('reminder')
|
||||
.setDescription('Remind a member that they\'re breaking the rules')
|
||||
.addUserOption(x=>x
|
||||
.setName('member')
|
||||
.setDescription('Which member to remind?')
|
||||
.setRequired(true))
|
||||
.addStringOption(x=>x
|
||||
.setName('reason')
|
||||
.setDescription('Reason for the reminder'))
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import Discord from 'discord.js';
|
||||
import TClient from '../client.js';
|
||||
import MessageTool from '../helpers/MessageTool.js';
|
||||
export default async(client:TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>, type: string)=>{
|
||||
export default async(client:TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>, type: 'ban'|'softban'|'kick'|'mute'|'warn'|'remind')=>{
|
||||
if (!MessageTool.isStaff(interaction.member)) return MessageTool.youNeedRole(interaction, 'dcmod');
|
||||
|
||||
const time = interaction.options.getString('time') ?? undefined;
|
||||
|
@ -139,7 +139,8 @@ export class PunishmentsSvc {
|
||||
softban: 'softbanned',
|
||||
kick: 'kicked',
|
||||
mute: 'muted',
|
||||
warn: 'warned'
|
||||
warn: 'warned',
|
||||
remind: 'reminded'
|
||||
}[type];
|
||||
}
|
||||
async punishmentAdd(type:string, options:{time?:string, interaction?:Discord.ChatInputCommandInteraction}, moderator:string, reason: string, user:Discord.User, guildUser?:Discord.GuildMember) {
|
||||
@ -147,7 +148,7 @@ export class PunishmentsSvc {
|
||||
const now = Date.now();
|
||||
const guild = this.client.guilds.cache.get(this.client.config.dcServer.id) as Discord.Guild;
|
||||
const punishment:Punishment = {type, case_id: await this.generateCaseId(), member: user.id, reason, moderator, time: now};
|
||||
const inOrFromBoolean = ['warn', 'mute'].includes(type) ? 'in' : 'from';
|
||||
const inOrFromBoolean = ['warn', 'mute', 'remind'].includes(type) ? 'in' : 'from';
|
||||
const auditLogReason = `${reason ?? 'Reason unspecified'} | Case #${punishment.case_id}`;
|
||||
const embed = new this.client.embed()
|
||||
.setColor(this.client.config.embedColor)
|
||||
|
Loading…
Reference in New Issue
Block a user