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

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

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

revision 86 by rakin, Mon Jul 29 17:28:32 2024 UTC revision 344 by rakin, Mon Jul 29 17:29:40 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, Guild, GuildMember, Interaction, Message, User } from 'discord.js';  import { CommandInteraction, Message } 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';  
 import History from '../../automod/History';  
 import getMember from '../../utils/getMember';  
 import ms from 'ms';  
7  import Note from '../../models/Note';  import Note from '../../models/Note';
8  import { fetchEmojiStr } from '../../utils/Emoji';  import { fetchEmojiStr } from '../../utils/Emoji';
9    
# Line 34  export default class NotedelCommand exte Line 30  export default class NotedelCommand exte
30          let id: string;          let id: string;
31    
32          if (options.isInteraction) {          if (options.isInteraction) {
33              id = await <string> options.options.getNumber('id')?.toString();              id = await <string> options.options.getString('id');
34          }          }
35          else {          else {
36              id = await options.args[0];              id = await options.args[0];
37          }          }
38    
39          const note = await Note.findOne({          const note = await Note.findOne({
40              where: {              guild_id: msg.guild!.id,
41                  guild_id: msg.guild!.id,              _id: id
                 id  
             }  
42          });          });
43    
44          if (!note) {          if (!note) {
# Line 52  export default class NotedelCommand exte Line 46  export default class NotedelCommand exte
46              return;              return;
47          }          }
48    
49          await note.destroy();          await note.delete();
50    
51          await msg.reply({          await msg.reply({
52              embeds: [              embeds: [

Legend:
Removed from v.86  
changed lines
  Added in v.344

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26