mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2026-11-08 10:51:18 -05:00
implement pino poc
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { Client, CommandInteraction, MessageFlags } from 'discord.js'
|
||||
import { AdminCommand, SlashCommand } from '../utils/index.js'
|
||||
import { createLogger } from '../components/index.js'
|
||||
|
||||
const logger = createLogger({ component: 'command', command: 'shutoff' })
|
||||
|
||||
export const Shutoff: SlashCommand = {
|
||||
name: 'shutoff',
|
||||
@@ -12,7 +15,7 @@ export const Shutoff: SlashCommand = {
|
||||
if (!channel || !AdminCommand.includes(channel.type)) return
|
||||
|
||||
// log this, this will probably be improtant for logging who did this
|
||||
console.log(`[Command: shutoff] User ${interaction.user.tag} attempting to shutdown ${client.user!!.tag}`)
|
||||
logger.info({ actor: interaction.user.tag, bot: client.user!!.tag }, 'Shutdown requested')
|
||||
|
||||
// check if admin or false on shutdown
|
||||
if (!interaction.memberPermissions?.has('Administrator')) {
|
||||
@@ -29,7 +32,7 @@ export const Shutoff: SlashCommand = {
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
|
||||
console.log(`[Command: shutoff] ${client.user?.tag} is shutting down.`)
|
||||
logger.info({ bot: client.user?.tag }, 'Bot is shutting down')
|
||||
|
||||
// clean up client instance and stop
|
||||
client.destroy()
|
||||
|
||||
Reference in New Issue
Block a user