/[sudobot]/trunk/src/commands/moderation/ShotCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/moderation/ShotCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/src/commands/moderation/BeanCommand.ts revision 191 by rakin, Mon Jul 29 17:28:57 2024 UTC trunk/src/commands/moderation/ShotCommand.ts revision 341 by rakin, Mon Jul 29 17:29:38 2024 UTC
# Line 4  import DiscordClient from '../../client/ Line 4  import DiscordClient from '../../client/
4  import CommandOptions from '../../types/CommandOptions';  import CommandOptions from '../../types/CommandOptions';
5  import InteractionOptions from '../../types/InteractionOptions';  import InteractionOptions from '../../types/InteractionOptions';
6  import MessageEmbed from '../../client/MessageEmbed';  import MessageEmbed from '../../client/MessageEmbed';
 import getUser from '../../utils/getUser';  
7  import getMember from '../../utils/getMember';  import getMember from '../../utils/getMember';
 import History from '../../automod/History';  
8  import Punishment from '../../models/Punishment';  import Punishment from '../../models/Punishment';
9  import PunishmentType from '../../types/PunishmentType';  import PunishmentType from '../../types/PunishmentType';
 import ModerationEmbed from '../../utils/ModerationEmbed';  
10    
11  export default class BeanCommand extends BaseCommand {  export default class ShotCommand extends BaseCommand {
12      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
13      supportsContextMenu: boolean = true;      supportsContextMenu: boolean = true;
14    
15      constructor() {      constructor() {
16          super('bean', 'moderation', ['Bean']);          super('shot', 'moderation', ['Shot']);
17      }      }
18    
19      async run(client: DiscordClient, msg: Message | CommandInteraction | ContextMenuInteraction, options: CommandOptions | InteractionOptions) {      async run(client: DiscordClient, msg: Message | CommandInteraction | ContextMenuInteraction, options: CommandOptions | InteractionOptions) {
# Line 88  export default class BeanCommand extends Line 85  export default class BeanCommand extends
85    
86          try {                      try {            
87              await Punishment.create({              await Punishment.create({
88                  type: PunishmentType.BEAN,                  type: PunishmentType.SHOT,
89                  user_id: user.id,                  user_id: user.id,
90                  guild_id: msg.guild!.id,                  guild_id: msg.guild!.id,
91                  mod_id: msg.member!.user.id,                  mod_id: msg.member!.user.id,
92                  mod_tag: (msg.member!.user as User).tag,                  mod_tag: (msg.member!.user as User).tag,
93                  reason                  reason,
94                    createdAt: new Date()
95              });              });
96    
97              await History.create(user.id, msg.guild!, 'bean', msg.member!.user.id, typeof reason === 'undefined' ? null : reason);              // await History.create(user.id, msg.guild!, 'bean', msg.member!.user.id, typeof reason === 'undefined' ? null : reason);
98    
99              try {              try {
100                  await user.send({                  await user.send({
# Line 104  export default class BeanCommand extends Line 102  export default class BeanCommand extends
102                          new MessageEmbed()                          new MessageEmbed()
103                              .setAuthor({                              .setAuthor({
104                                  iconURL: <string> msg.guild!.iconURL(),                                  iconURL: <string> msg.guild!.iconURL(),
105                                  name: `\tYou have been beaned in ${msg.guild!.name}`                                  name: `\tYou got a shot in ${msg.guild!.name}`
106                              })                              })
107                              .addFields([                              .addFields([
108                                  {                                  {
# Line 120  export default class BeanCommand extends Line 118  export default class BeanCommand extends
118                  dm = false;                  dm = false;
119              }              }
120    
121              await client.logger.logBeaned(user, typeof reason === 'undefined' ? '*No reason provided*' : reason, msg.member!.user as User);              // await client.logger.logBeaned(user, typeof reason === 'undefined' ? '*No reason provided*' : reason, msg.member!.user as User);
122          }          }
123          catch (e) {          catch (e) {
124              console.log(e);                          console.log(e);            
125          }          }
126    
127          /*await msg.reply({          await msg.reply({
128              embeds: [              embeds: [
129                  new MessageEmbed()                  new MessageEmbed()
130                  .setAuthor({                  .setAuthor({
131                      name: user.user.tag,                      name: user.user.tag,
132                      iconURL: user.user.displayAvatarURL(),                      iconURL: user.user.displayAvatarURL(),
133                  })                  })
134                  .setDescription(user.user.tag + " has been beaned." + (!dm ? "\nThey have DMs disabled. They will not know that they have been beaned." : ''))                  .setDescription(user.user.tag + " got a shot." + (!dm ? "\nThey have DMs disabled. They will not know that they got a shot." : ''))
135                  .addFields([                  .addFields([
136                      {                      {
137                          name: "Beaned by",                          name: "Given by",
138                          value: (msg.member!.user as User).tag                          value: (msg.member!.user as User).tag
139                      },                      },
140                      {                      {
# Line 145  export default class BeanCommand extends Line 143  export default class BeanCommand extends
143                      }                      }
144                  ])                  ])
145              ]              ]
         });*/  
   
         await msg.reply({  
             embeds: [  
                 new ModerationEmbed(user.user, msg.member!.user as User, {  
                     description: `${user.user.tag} has been beaned.`  
                 })  
                 .setReason(reason)  
             ]  
146          });          });
147      }      }
148  }  }

Legend:
Removed from v.191  
changed lines
  Added in v.341

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26