From 90b0e6af5519356e0e99a9e69313c2e01b4d713a Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Thu, 22 Aug 2024 10:12:02 -0400 Subject: [PATCH] command: consolidate definitions --- command/command.go | 15 ++++++++++++++- command/robot.go | 19 ------------------- 2 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 command/robot.go diff --git a/command/command.go b/command/command.go index 1fd334b..ec9e745 100644 --- a/command/command.go +++ b/command/command.go @@ -2,12 +2,25 @@ package command import ( "context" + "log/slog" + "github.com/zephyrtronium/robot/brain" "github.com/zephyrtronium/robot/channel" "github.com/zephyrtronium/robot/message" + "github.com/zephyrtronium/robot/privacy" + "github.com/zephyrtronium/robot/spoken" "github.com/zephyrtronium/robot/userhash" ) +// Robot is the bot state as is visible to commands. +type Robot struct { + Log *slog.Logger + Channels map[string]*channel.Channel // TODO(zeph): syncmap[string]channel.Channel + Brain brain.Brain + Privacy *privacy.List + Spoken *spoken.History +} + // Invocation is a command invocation. An Invocation and its fields must not // be modified or retained by any command. type Invocation struct { @@ -22,5 +35,5 @@ type Invocation struct { Hasher userhash.Hasher } -// Func executes a command. +// Func is a command function. type Func func(ctx context.Context, robo *Robot, call *Invocation) diff --git a/command/robot.go b/command/robot.go deleted file mode 100644 index 885a6bd..0000000 --- a/command/robot.go +++ /dev/null @@ -1,19 +0,0 @@ -package command - -import ( - "log/slog" - - "github.com/zephyrtronium/robot/brain" - "github.com/zephyrtronium/robot/channel" - "github.com/zephyrtronium/robot/privacy" - "github.com/zephyrtronium/robot/spoken" -) - -// Robot is the bot state as is visible to commands. -type Robot struct { - Log *slog.Logger - Channels map[string]*channel.Channel // TODO(zeph): syncmap[string]channel.Channel - Brain brain.Brain - Privacy *privacy.List - Spoken *spoken.History -}