5 |
import InteractionOptions from '../../types/InteractionOptions'; |
import InteractionOptions from '../../types/InteractionOptions'; |
6 |
import MessageEmbed from '../../client/MessageEmbed'; |
import MessageEmbed from '../../client/MessageEmbed'; |
7 |
import getUser from '../../utils/getUser'; |
import getUser from '../../utils/getUser'; |
|
import getMember from '../../utils/getMember'; |
|
|
import History from '../../automod/History'; |
|
|
import { fetchEmoji } from '../../utils/Emoji'; |
|
|
import PunishmentType from '../../types/PunishmentType'; |
|
8 |
import Note from '../../models/Note'; |
import Note from '../../models/Note'; |
9 |
|
|
10 |
export default class NotesCommand extends BaseCommand { |
export default class NotesCommand extends BaseCommand { |
18 |
const limit = 5; |
const limit = 5; |
19 |
const offset = ((page < 1 ? 1 : page) - 1) * limit; |
const offset = ((page < 1 ? 1 : page) - 1) * limit; |
20 |
|
|
21 |
const notes = await Note.findAndCountAll({ |
const notes = await Note.find({ |
22 |
where: { |
guild_id: msg.guild!.id, |
23 |
guild_id: msg.guild!.id, |
user_id: user.id, |
24 |
user_id: user.id |
}).skip(offset).limit(limit).sort("createdAt"); |
|
}, |
|
|
order: [ |
|
|
['createdAt', 'DESC'] |
|
|
], |
|
|
limit, |
|
|
offset |
|
|
}); |
|
25 |
|
|
26 |
let str = ''; |
let str = ''; |
27 |
const maxPage = Math.ceil(notes.count / limit); |
const maxPage = Math.ceil(notes.length / limit); |
28 |
|
|
29 |
for await (const note of notes.rows) { |
for await (const note of notes) { |
30 |
str += `**Note ID**: ${note.get().id}\n`; |
str += `**Note ID**: ${note.id}\n`; |
31 |
str += `Note taken by: ${note.get().mod_tag}\n`; |
str += `Note taken by: ${note.mod_tag}\n`; |
32 |
str += `Date: ${note.get().createdAt.toLocaleString()}\n`; |
str += `Date: ${note.createdAt.toLocaleString()}\n`; |
33 |
str += `Content:\n\`\`\`\n${note.get().content}\n\`\`\`\n`; |
str += `Content:\n\`\`\`\n${note.content}\n\`\`\`\n`; |
34 |
str += '\n'; |
str += '\n'; |
35 |
} |
} |
36 |
|
|