rename bot/chat to bot/msg

This commit is contained in:
Tnze
2022-11-27 16:10:06 +08:00
parent fad92fe364
commit f19d39c6d0
4 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
package chat
package msg
import (
"fmt"
@ -13,14 +13,14 @@ import (
"github.com/google/uuid"
)
type Chat struct {
type Manager struct {
c *bot.Client
p *basic.Player
}
func NewChat(c *bot.Client, p *basic.Player, events EventsHandler) *Chat {
func New(c *bot.Client, p *basic.Player, events EventsHandler) *Manager {
attachPlayerMsg(c, p, events.PlayerChatMessage)
return &Chat{c, p}
return &Manager{c, p}
}
func attachPlayerMsg(c *bot.Client, p *basic.Player, handler func(msg chat.Message) error) {

View File

@ -1,4 +1,4 @@
package chat
package msg
import "github.com/Tnze/go-mc/chat"

View File

@ -8,7 +8,7 @@ import (
"github.com/Tnze/go-mc/bot"
"github.com/Tnze/go-mc/bot/basic"
botchat "github.com/Tnze/go-mc/bot/chat"
"github.com/Tnze/go-mc/bot/msg"
"github.com/Tnze/go-mc/chat"
_ "github.com/Tnze/go-mc/data/lang/en-us"
"github.com/Tnze/go-mc/data/packetid"
@ -20,7 +20,7 @@ const timeout = 45
var (
c *bot.Client
p *basic.Player
bc *botchat.Chat
bc *msg.Manager
watch chan time.Time
)
@ -34,7 +34,7 @@ func main() {
Disconnect: onDisconnect,
Death: onDeath,
})
bc = botchat.NewChat(c, p, botchat.EventsHandler{PlayerChatMessage: onChatMsg})
bc = msg.New(c, p, msg.EventsHandler{PlayerChatMessage: onChatMsg})
// Register event handlers

View File

@ -12,7 +12,7 @@ import (
"github.com/Tnze/go-mc/bot"
"github.com/Tnze/go-mc/bot/basic"
botchat "github.com/Tnze/go-mc/bot/chat"
"github.com/Tnze/go-mc/bot/msg"
"github.com/Tnze/go-mc/bot/screen"
"github.com/Tnze/go-mc/bot/world"
"github.com/Tnze/go-mc/chat"
@ -31,7 +31,7 @@ var (
var (
client *bot.Client
player *basic.Player
chatHandler *botchat.Chat
chatHandler *msg.Manager
worldManager *world.World
screenManager *screen.Manager
)
@ -52,7 +52,7 @@ func main() {
HealthChange: onHealthChange,
Death: onDeath,
})
chatHandler = botchat.NewChat(client, player, botchat.EventsHandler{
chatHandler = msg.New(client, player, msg.EventsHandler{
PlayerChatMessage: onPlayerMsg,
})
worldManager = world.NewWorld(client, player, world.EventsListener{