Advertisement
lord_shadow

Untitled

Jan 18th, 2022
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { discordClient } from '../../main';
  2. import { MessageEmbed } from 'discord.js';
  3. import { CommandContext } from '../../structures/addons/CommandAddons';
  4. import { Command } from '../../structures/Command';
  5. import { groupBy } from 'lodash';
  6. import {
  7.     getCommandInfoEmbed,
  8.     getCommandListEmbed,
  9.     getCommandNotFoundEmbed,
  10. } from '../../handlers/locale';
  11.  
  12. class WarnCommand extends Command {
  13.     constructor() {
  14.         super({
  15.             trigger: 'warn',
  16.             description: 'warns a member',
  17.             type: 'ChatInput',
  18.             module: 'test',
  19.             args: [
  20.               {
  21.                     trigger: 'member',
  22.                     description: 'Who do you want to warn?',
  23.                     isLegacyFlag: false,
  24.                     required: true,
  25.                     type: 'DiscordUser',
  26.                 },
  27.                 {
  28.                     trigger: 'reason',
  29.                     description: 'Reason for warning this member.',
  30.                     isLegacyFlag: false,
  31.                     required: true,
  32.                     type: 'String',
  33.                 },
  34.             ]
  35.         });
  36.     }
  37.  
  38.     async run(ctx: CommandContext) {
  39.  
  40.  
  41. const nothing = ctx.member
  42.  
  43. const nothingEmbed = new MessageEmbed()
  44.  
  45. .setDescription('You did not provide anyone to warn!')
  46. .setColor('RED');
  47.  
  48. const embed = new MessageEmbed()
  49.  
  50. .setDescription('You cannot warn this person as they are not in the server!')
  51. .setColor('RED');
  52.  
  53.   let member = ctx.args['member']
  54.   console.log(member)
  55.         if(!member) return ctx.reply({ embeds: [nothingEmbed] })
  56.         if(!member) return ctx.reply({ embeds: [embed] })
  57.  
  58. const errorEmbed = new MessageEmbed()
  59.  
  60. .setDescription('Please enter a reason!')
  61. .setColor('RED');
  62.  
  63.   let reason = ctx.args['reason']
  64.   console.log(reason)
  65.   if(!reason) return ctx.reply({ embeds: [errorEmbed] })
  66.  
  67.   const successEmbed = new MessageEmbed()
  68.  
  69. .setTitle('Success!')
  70. .setColor('GREEN')
  71. .setDescription(`Successfully warned <@${member}>!`)
  72. .setTimestamp();
  73.  
  74. nothing.send({ embeds: [successEmbed] });
  75.  
  76.   let warnembed = new MessageEmbed()
  77.   .setDescription(`**Server:** ${ctx.guild.name}\n**Actioned by:** <@${ctx.user.id}>\n**Action:** Warn\n**Reason:** ${reason}`)
  78.   .setColor('RED')
  79.   .setTimestamp();
  80.  
  81.   ctx.member.send({ embeds: [warnembed] });
  82.     }
  83. }
  84.  
  85. export default WarnCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement