Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
chore: add tips
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoo committed Oct 25, 2023
1 parent 242166f commit 718acce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions v2/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ func (e *EventStruct) GetTextContent() string {
return e.CurrentPacket.EventData.MsgBody.Content
}
func (e *EventStruct) ParseTextMsg() ITextMsg {
if e.CurrentPacket.EventData.MsgBody == nil {
panic("非文本消息事件,解析失败")
}
return e
}
func (e *EventStruct) ParseGroupMsg() IGroupMsg {
Expand Down Expand Up @@ -310,6 +313,9 @@ func (e *EventStruct) GetLoginSuccessBot() (nick string, uin int64) {
}

func (e *EventStruct) ParsePicMsg() IPicMsg {
if e.CurrentPacket.EventData.MsgBody == nil || e.CurrentPacket.EventData.MsgBody.Images == nil {
panic("不包含图片,解析失败")
}
return e
}
func (e *EventStruct) GetPics() []Image {
Expand Down
2 changes: 1 addition & 1 deletion v2/opqbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (c *Core) ListenAndWait(ctx context.Context) (e error) {
if c.handlePanic != nil {
c.handlePanic(err)
} else {
log.Infof("event handle function panic: %s \n%s", err, string(debug.Stack()))
log.Debugf("event handle function panic: %s \n%s", err, string(debug.Stack()))
}
}
}()
Expand Down

0 comments on commit 718acce

Please sign in to comment.