Skip to content

Commit

Permalink
fix(dish): 修复客官名显示为菜名的问题 (#1000)
Browse files Browse the repository at this point in the history
* fix(dish): 修复客官名显示为菜名的问题
去除了多余的换行

* optimize(dish): 去除不必要的 fmt.Sprintf
  • Loading branch information
Kittengarten authored Oct 9, 2024
1 parent 410dd05 commit b777b34
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions plugin/dish/dish.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {
return
}

name := ctx.NickName()
name := ctx.CardOrNickName(ctx.Event.UserID)
dishName := ctx.State["args"].(string)

if dishName == "" {
Expand All @@ -82,12 +82,10 @@ func init() {
return
}

ctx.SendChain(message.Text(fmt.Sprintf(
"已为客官%s找到%s的做法辣!\n"+
"原材料:%s\n"+
"步骤:\n"+
"%s",
name, d.Name, d.Materials, d.Steps),
ctx.SendChain(message.Text(
"已为客官", name, "找到", d.Name, "的做法辣!\n",
"原材料:", d.Materials, "\n",
"步骤:", d.Steps,
))
})

Expand All @@ -105,12 +103,10 @@ func init() {
return
}

ctx.SendChain(message.Text(fmt.Sprintf(
"已为客官%s送上%s的做法:\n"+
"原材料:%s\n"+
"步骤:\n"+
"%s",
name, d.Name, d.Materials, d.Steps),
ctx.SendChain(message.Text(
"已为客官", name, "送上", d.Name, "的做法:\n",
"原材料:", d.Materials, "\n",
"步骤:", d.Steps,
))
})
}

0 comments on commit b777b34

Please sign in to comment.