/[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

revision 197 by rakin, Mon Jul 29 17:28:59 2024 UTC revision 392 by rakin, Mon Jul 29 17:29:56 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, ContextMenuInteraction, GuildMember, Interaction, Message, User } from 'discord.js';  import { CommandInteraction, ContextMenuInteraction, GuildMember, Message, User } from 'discord.js';
2  import BaseCommand from '../../utils/structures/BaseCommand';  import BaseCommand from '../../utils/structures/BaseCommand';
3  import DiscordClient from '../../client/Client';  import DiscordClient from '../../client/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 ShotCommand extends BaseCommand {  export default class ShotCommand extends BaseCommand {
12      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
# Line 35  export default class ShotCommand extends Line 32  export default class ShotCommand extends
32          let user: GuildMember;          let user: GuildMember;
33          let dm = true;          let dm = true;
34          let reason: string | undefined;          let reason: string | undefined;
35            
36          if (options.isInteraction) {          if (options.isInteraction) {
37              user = await <GuildMember> (msg instanceof ContextMenuInteraction ? options.options.getMember('user') : options.options.getMember('member'));              user = await <GuildMember> (msg instanceof ContextMenuInteraction ? options.options.getMember('user') : options.options.getMember('member'));
38    
# Line 86  export default class ShotCommand extends Line 83  export default class ShotCommand extends
83              }              }
84          }          }
85    
86            if (user.id === client.user?.id) {
87                const random = Math.random() >= 0.5;
88                
89                await msg.reply({
90                    content: `Oh no no no... wait wait, you can't just do that with me${random ? "... I'm such an innocent bot :innocent:, PWEASE don't do that :pleading_face:" : "!?!? Can you?"}`,
91                    files: [random ? "https://tenor.com/view/folded-hands-emoji-funny-animals-gray-cat-cute-pwease-gif-14039745.gif" : 'https://tenor.com/view/are-you-even-capable-vera-bennett-wentworth-can-you-handle-this-are-you-qualified-gif-22892513.gif']
92                });
93    
94                return;
95            }
96    
97            const anonymous = options.isInteraction ? options.options.getBoolean('anonymous') ?? false : false;
98    
99          try {                      try {            
100              await Punishment.create({              await Punishment.create({
101                  type: PunishmentType.SHOT,                  type: PunishmentType.SHOT,
# Line 93  export default class ShotCommand extends Line 103  export default class ShotCommand extends
103                  guild_id: msg.guild!.id,                  guild_id: msg.guild!.id,
104                  mod_id: msg.member!.user.id,                  mod_id: msg.member!.user.id,
105                  mod_tag: (msg.member!.user as User).tag,                  mod_tag: (msg.member!.user as User).tag,
106                  reason                  reason,
107                    createdAt: new Date()
108              });              });
109    
110              // 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);
# Line 110  export default class ShotCommand extends Line 121  export default class ShotCommand extends
121                                  {                                  {
122                                      name: "Reason",                                      name: "Reason",
123                                      value: typeof reason === 'undefined' ? '*No reason provided*' : reason                                      value: typeof reason === 'undefined' ? '*No reason provided*' : reason
124                                  }                                  },
125                                    ...(!anonymous ? [{
126                                        name: "💉 Doctor",
127                                        value: `${(msg.member?.user as User).tag}`
128                                    }] : [])
129                              ])                              ])
130                      ]                      ]
131                  });                  });
# Line 136  export default class ShotCommand extends Line 151  export default class ShotCommand extends
151                  .setDescription(user.user.tag + " got a shot." + (!dm ? "\nThey have DMs disabled. They will not know that they got a shot." : ''))                  .setDescription(user.user.tag + " got a shot." + (!dm ? "\nThey have DMs disabled. They will not know that they got a shot." : ''))
152                  .addFields([                  .addFields([
153                      {                      {
154                          name: "Given by",                          name: "💉 Doctor",
155                          value: (msg.member!.user as User).tag                          value: (msg.member!.user as User).tag
156                      },                      },
157                      {                      {

Legend:
Removed from v.197  
changed lines
  Added in v.392

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26