34 |
let id: string; |
let id: string; |
35 |
|
|
36 |
if (options.isInteraction) { |
if (options.isInteraction) { |
37 |
id = await <string> options.options.getNumber('id')?.toString(); |
id = await <string> options.options.getString('id'); |
38 |
} |
} |
39 |
else { |
else { |
40 |
id = await options.args[0]; |
id = await options.args[0]; |
41 |
} |
} |
42 |
|
|
43 |
const note = await Note.findOne({ |
const note = await Note.findOne({ |
44 |
where: { |
guild_id: msg.guild!.id, |
45 |
guild_id: msg.guild!.id, |
_id: id |
|
id |
|
|
} |
|
46 |
}); |
}); |
47 |
|
|
48 |
if (!note) { |
if (!note) { |
53 |
let user; |
let user; |
54 |
|
|
55 |
try { |
try { |
56 |
user = await client.users.fetch(note.get().user_id); |
user = await client.users.fetch(note.user_id); |
57 |
} |
} |
58 |
catch (e) { |
catch (e) { |
59 |
console.log(e); |
console.log(e); |
63 |
embeds: [ |
embeds: [ |
64 |
new MessageEmbed({ |
new MessageEmbed({ |
65 |
author: { |
author: { |
66 |
name: user?.tag ?? note.get().user_id, |
name: user?.tag ?? note.user_id, |
67 |
iconURL: user instanceof User ? user.displayAvatarURL() : undefined, |
iconURL: user instanceof User ? user.displayAvatarURL() : undefined, |
68 |
}, |
}, |
69 |
description: note.get().content, |
description: note.content, |
70 |
fields: [ |
fields: [ |
71 |
{ |
{ |
72 |
name: 'Note taken by', |
name: 'Note taken by', |
73 |
value: note.get().mod_tag |
value: note.mod_tag |
74 |
} |
} |
75 |
], |
], |
76 |
footer: { |
footer: { |
77 |
text: `ID: ${note.get().id}` |
text: `ID: ${note.id}` |
78 |
}, |
}, |
79 |
timestamp: note.get().createdAt |
timestamp: note.createdAt |
80 |
}) |
}) |
81 |
] |
] |
82 |
}); |
}); |