Create /setmotd command; use /motd to display it

/motd displays the motd instead of changing it, so that a (non op) user can see it without having to rejoin.
Motd can be set by op with /setmotd
This commit is contained in:
The8BitGuy42 2016-08-03 21:23:33 +02:00 committed by GitHub
parent a55b78ccdb
commit f346fa737a

13
host.go
View File

@ -422,7 +422,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
c.Add(chat.Command{
Op: true,
Prefix: "/motd",
Prefix: "/setmotd",
PrefixHelp: "MESSAGE",
Help: "Set the MESSAGE of the day.",
Handler: func(room *chat.Room, msg message.CommandMsg) error {
@ -446,6 +446,17 @@ func (h *Host) InitCommands(c *chat.Commands) {
return nil
},
})
c.Add(chat.Command{
Prefix: "/motd",
Help: "Display the MESSAGE of the day.",
Handler: func(room *chat.Room, msg message.CommandMsg) error {
room.Send(message.NewAnnounceMsg(h.motd))
return nil
},
})
c.Add(chat.Command{
Op: true,