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

Diff of /trunk/src/commands/moderation/NotegetCommand.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 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';  
 import History from '../../automod/History';  
 import getMember from '../../utils/getMember';  
 import ms from 'ms';  
7  import { fetchEmojiStr } from '../../utils/Emoji';  import { fetchEmojiStr } from '../../utils/Emoji';
8  import Note from '../../models/Note';  import Note from '../../models/Note';
9    
# Line 34  export default class NotegetCommand exte Line 30  export default class NotegetCommand 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 55  export default class NotegetCommand exte Line 49  export default class NotegetCommand exte
49          let user;          let user;
50    
51          try {          try {
52              user = await client.users.fetch(note.get().user_id);              user = await client.users.fetch(note.user_id);
53          }          }
54          catch (e) {          catch (e) {
55              console.log(e);                          console.log(e);            
# Line 65  export default class NotegetCommand exte Line 59  export default class NotegetCommand exte
59              embeds: [              embeds: [
60                  new MessageEmbed({                  new MessageEmbed({
61                      author: {                      author: {
62                          name: user?.tag ?? note.get().user_id,                          name: user?.tag ?? note.user_id,
63                          iconURL: user instanceof User ? user.displayAvatarURL() : undefined,                          iconURL: user instanceof User ? user.displayAvatarURL() : undefined,
64                      },                      },
65                      description: note.get().content,                      description: note.content,
66                      fields: [                      fields: [
67                          {                          {
68                              name: 'Note taken by',                              name: 'Note taken by',
69                              value: note.get().mod_tag                              value: note.mod_tag
70                          }                          }
71                      ],                      ],
72                      footer: {                      footer: {
73                          text: `ID: ${note.get().id}`                          text: `ID: ${note.id}`
74                      },                      },
75                      timestamp: note.get().createdAt                      timestamp: note.createdAt
76                  })                  })
77              ]              ]
78          });          });

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26