Skip to content

Commit b73b456

Browse files
committed
host: Fix /msg vs /reply message formatting
Closes shazow#382
1 parent 7a783d4 commit b73b456

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

host.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,17 @@ func (h *Host) GetUser(name string) (*message.User, bool) {
334334
// InitCommands adds host-specific commands to a Commands container. These will
335335
// override any existing commands.
336336
func (h *Host) InitCommands(c *chat.Commands) {
337-
sendPM := func(room *chat.Room, msg message.CommandMsg, target *message.User) error {
338-
m := message.NewPrivateMsg(strings.Join(msg.Args(), " "), msg.From(), target)
337+
sendPM := func(room *chat.Room, msg string, from *message.User, target *message.User) error {
338+
m := message.NewPrivateMsg(msg, from, target)
339339
room.Send(&m)
340340

341341
txt := fmt.Sprintf("[Sent PM to %s]", target.Name())
342342
if isAway, _, awayReason := target.GetAway(); isAway {
343343
txt += " Away: " + awayReason
344344
}
345-
sysMsg := message.NewSystemMsg(txt, msg.From())
345+
sysMsg := message.NewSystemMsg(txt, from)
346346
room.Send(sysMsg)
347-
target.SetReplyTo(msg.From())
347+
target.SetReplyTo(from)
348348
return nil
349349
}
350350

@@ -366,7 +366,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
366366
return errors.New("user not found")
367367
}
368368

369-
return sendPM(room, msg, target)
369+
return sendPM(room, strings.Join(args[1:], " "), msg.From(), target)
370370
},
371371
})
372372

@@ -391,7 +391,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
391391
return errors.New("user not found")
392392
}
393393

394-
return sendPM(room, msg, target)
394+
return sendPM(room, strings.Join(args, " "), msg.From(), target)
395395
},
396396
})
397397

0 commit comments

Comments
 (0)