|
| 1 | +import { ChatInputCommand } from '@/types' |
| 2 | +import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js' |
| 3 | + |
| 4 | +export const pmCommand: ChatInputCommand = { |
| 5 | + data: new SlashCommandBuilder() |
| 6 | + .setName('pm') |
| 7 | + .setDescription('Send a private message.') |
| 8 | + .addStringOption((option) => |
| 9 | + option.setName('id').setDescription('Discord User ID').setRequired(true), |
| 10 | + ) |
| 11 | + .addStringOption((option) => |
| 12 | + option.setName('message').setDescription('Private message').setRequired(true), |
| 13 | + ) |
| 14 | + .addStringOption((option) => |
| 15 | + option.setName('title').setDescription('Embed title').setRequired(false), |
| 16 | + ) as SlashCommandBuilder, |
| 17 | + meta: { |
| 18 | + name: 'reset', |
| 19 | + description: 'Reset user active role and message counter', |
| 20 | + category: 'moderation', |
| 21 | + guildOnly: true, |
| 22 | + }, |
| 23 | + execute: async (interaction: ChatInputCommandInteraction) => { |
| 24 | + if (!interaction.guild) return |
| 25 | + |
| 26 | + const id = interaction.options.getString('id', true) |
| 27 | + const message = interaction.options.getString('message', true) |
| 28 | + const title = interaction.options.getString('title', false) |
| 29 | + const member = await interaction.guild.members.fetch(id) |
| 30 | + |
| 31 | + const embed = new EmbedBuilder() |
| 32 | + .setColor(0x1bd96a) |
| 33 | + .setTitle(title ? title : 'Message from a moderator') |
| 34 | + .setDescription(message) |
| 35 | + |
| 36 | + await member.user.send({ embeds: [embed] }) |
| 37 | + }, |
| 38 | +} |
0 commit comments