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 |
|
|
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) { |
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); |
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 |
}); |
}); |