set status edits message from ticket
This commit is contained in:
parent
0b7798a700
commit
1fdb8f451b
@ -99,6 +99,7 @@ export class CreateTicketSystem {
|
||||
embeds: [ticketWorkloadEmbed({ workload })],
|
||||
})
|
||||
await db.set(DBTableEnum.WORKLOAD_MESSAGE, workloadMessage.id)
|
||||
await db.set(DBTableEnum.WORKLOAD_CHANNEL, interaction.channel.id)
|
||||
|
||||
// close interaction
|
||||
await interaction.editReply('✔️ Created ticket system')
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Discord, Slash, SlashChoice, SlashOption } from 'discordx'
|
||||
import { ApplicationCommandOptionType, CommandInteraction } from 'discord.js'
|
||||
import { ApplicationCommandOptionType, CommandInteraction, GuildBasedChannel } from 'discord.js'
|
||||
|
||||
import { db, DBTableEnum } from '../../db'
|
||||
import { Workload } from '../../utils'
|
||||
import { ticketWorkloadEmbed, Workload } from '../../utils'
|
||||
import { logger } from '../../lib'
|
||||
|
||||
@Discord()
|
||||
@ -30,6 +30,18 @@ export class SetStatus {
|
||||
})
|
||||
return
|
||||
})
|
||||
|
||||
const statusMsg = await db.get(DBTableEnum.WORKLOAD_MESSAGE)
|
||||
const statusChannelId = await db.get(DBTableEnum.WORKLOAD_CHANNEL)
|
||||
if (statusMsg && statusChannelId) {
|
||||
const statusChannel = await interaction.guild?.channels.fetch(statusChannelId)
|
||||
if (!statusChannel || !statusChannel.isTextBased()) return
|
||||
const workloadMsg = await statusChannel.messages.fetch(statusMsg)
|
||||
await workloadMsg.edit({
|
||||
embeds: [ticketWorkloadEmbed({ workload: status as Workload })]
|
||||
})
|
||||
}
|
||||
|
||||
logger.database(DBTableEnum.WORKLOAD, status)
|
||||
await interaction.editReply({
|
||||
content: `✔️ Set workload status to ${status}`,
|
||||
|
Loading…
Reference in New Issue
Block a user