fix: status
This commit is contained in:
@@ -2,12 +2,13 @@ import type { BotContext, ComponentLifecycle } from '../composables/bot'
|
||||
import { useLogg } from '@guiiai/logg'
|
||||
import { registerCommand } from '../composables/command'
|
||||
|
||||
const status = new Map<string, string>()
|
||||
|
||||
export function getStatusToString(ctx: BotContext): string {
|
||||
return Array.from(getStatus(ctx).entries()).map(([key, value]) => `${key}: ${value}`).join('\n')
|
||||
}
|
||||
|
||||
export function getStatus(ctx: BotContext): Map<string, string> {
|
||||
const status = new Map<string, string>()
|
||||
const pos = ctx.bot.entity.position
|
||||
const weather = ctx.bot.isRaining ? 'Rain' : ctx.bot.thunderState ? 'Thunderstorm' : 'Clear'
|
||||
const timeOfDay = ctx.bot.time.timeOfDay < 6000
|
||||
@@ -28,8 +29,8 @@ export function createStatusComponent(ctx: BotContext): ComponentLifecycle {
|
||||
|
||||
registerCommand('status', () => {
|
||||
logger.log('Status command received')
|
||||
const status = getStatus(ctx)
|
||||
ctx.bot.chat(status.toString())
|
||||
const status = getStatusToString(ctx)
|
||||
ctx.bot.chat(status)
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user