Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { discordClient } from '../../main';
- import { MessageEmbed } from 'discord.js';
- import { CommandContext } from '../../structures/addons/CommandAddons';
- import { Command } from '../../structures/Command';
- import { groupBy } from 'lodash';
- import {
- getCommandInfoEmbed,
- getCommandListEmbed,
- getCommandNotFoundEmbed,
- } from '../../handlers/locale';
- class WarnCommand extends Command {
- constructor() {
- super({
- trigger: 'warn',
- description: 'warns a member',
- type: 'ChatInput',
- module: 'test',
- args: [
- {
- trigger: 'member',
- description: 'Who do you want to warn?',
- isLegacyFlag: false,
- required: true,
- type: 'DiscordUser',
- },
- {
- trigger: 'reason',
- description: 'Reason for warning this member.',
- isLegacyFlag: false,
- required: true,
- type: 'String',
- },
- ]
- });
- }
- async run(ctx: CommandContext) {
- const nothing = ctx.member
- const nothingEmbed = new MessageEmbed()
- .setDescription('You did not provide anyone to warn!')
- .setColor('RED');
- const embed = new MessageEmbed()
- .setDescription('You cannot warn this person as they are not in the server!')
- .setColor('RED');
- let member = ctx.args['member']
- console.log(member)
- if(!member) return ctx.reply({ embeds: [nothingEmbed] })
- if(!member) return ctx.reply({ embeds: [embed] })
- const errorEmbed = new MessageEmbed()
- .setDescription('Please enter a reason!')
- .setColor('RED');
- let reason = ctx.args['reason']
- console.log(reason)
- if(!reason) return ctx.reply({ embeds: [errorEmbed] })
- const successEmbed = new MessageEmbed()
- .setTitle('Success!')
- .setColor('GREEN')
- .setDescription(`Successfully warned <@${member}>!`)
- .setTimestamp();
- nothing.send({ embeds: [successEmbed] });
- let warnembed = new MessageEmbed()
- .setDescription(`**Server:** ${ctx.guild.name}\n**Actioned by:** <@${ctx.user.id}>\n**Action:** Warn\n**Reason:** ${reason}`)
- .setColor('RED')
- .setTimestamp();
- ctx.member.send({ embeds: [warnembed] });
- }
- }
- export default WarnCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement