fix: 修改多个处理函数的返回类型为指针类型,以提高内存使用效率并避免不必要的拷贝
This commit is contained in:
@@ -17,17 +17,17 @@ func init() {
|
||||
handler.RegisterHelpInform("roll [次数]d[面数]", "roll", "掷骰")
|
||||
}
|
||||
|
||||
func roll(msg model.Message) (reply model.Reply) {
|
||||
func roll(msg model.Message) (reply *model.Reply) {
|
||||
act, err := ParseRollExpression(msg.RawMsg)
|
||||
if err != nil {
|
||||
return model.Reply{
|
||||
return &model.Reply{
|
||||
ReplyMsg: "",
|
||||
ReferOriginMsg: false,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
result, results := RollDice(act)
|
||||
return model.Reply{
|
||||
return &model.Reply{
|
||||
ReplyMsg: "掷骰结果: " + strconv.Itoa(result) + "点 " + fmt.Sprint(results),
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
|
||||
Reference in New Issue
Block a user