mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-18 08:43:57 +00:00
feat(utils/discord/embeds): allow adding extra fields for moderation embeds
This commit is contained in:
@@ -46,15 +46,18 @@ export const createModerationActionEmbed = (
|
|||||||
moderator: User,
|
moderator: User,
|
||||||
reason?: string,
|
reason?: string,
|
||||||
expires?: number | null,
|
expires?: number | null,
|
||||||
|
extraFields?: EmbedField[][],
|
||||||
) => {
|
) => {
|
||||||
const fields: EmbedField[] = []
|
const fields: EmbedField[] = []
|
||||||
|
if (extraFields?.[0]) fields.push(...extraFields[0])
|
||||||
if (reason) fields.push({ name: 'Reason', value: reason, inline: true })
|
if (reason) fields.push({ name: 'Reason', value: reason, inline: true })
|
||||||
if (Number.isInteger(expires) || expires === null)
|
if (Number.isInteger(expires) || expires === null)
|
||||||
fields.push({
|
fields.push({
|
||||||
name: 'Expires',
|
name: 'Expires',
|
||||||
value: Number.isInteger(expires) ? new Date(expires! * 1000).toLocaleString() : 'Never',
|
value: Number.isInteger(expires) ? `<t:${expires}:F>` : 'Never',
|
||||||
inline: true,
|
inline: true,
|
||||||
})
|
})
|
||||||
|
if (extraFields?.[1]) fields.push(...extraFields[1])
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(`${action} ${user.tag}`)
|
.setTitle(`${action} ${user.tag}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user