mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-08 20:20:23 +08:00
optimize: trim content
This commit is contained in:
1
event.go
1
event.go
@@ -115,6 +115,7 @@ func (bot *Bot) processEvent(payload *WebsocketPayload) {
|
|||||||
|
|
||||||
func match(ctx *Ctx, matchers []*Matcher) {
|
func match(ctx *Ctx, matchers []*Matcher) {
|
||||||
if ctx.Message != nil && ctx.Message.Content != "" { // 确保无空
|
if ctx.Message != nil && ctx.Message.Content != "" { // 确保无空
|
||||||
|
ctx.Message.Content = strings.TrimSpace(ctx.Message.Content)
|
||||||
if !ctx.IsToMe {
|
if !ctx.IsToMe {
|
||||||
ctx.IsToMe = func(ctx *Ctx) bool {
|
ctx.IsToMe = func(ctx *Ctx) bool {
|
||||||
name := ctx.GetReady().User.Username
|
name := ctx.GetReady().User.Username
|
||||||
|
|||||||
Reference in New Issue
Block a user