mirror of
https://github.com/awfufu/go-hurobot.git
synced 2026-03-01 05:29:43 +08:00
fix: prevent panic when accessing empty message array in HandleCommand
This commit is contained in:
@@ -48,9 +48,12 @@ func init() {
|
||||
|
||||
func HandleCommand(c *qbot.Client, msg *qbot.Message) bool {
|
||||
skip := 0
|
||||
if len(msg.Array) == 0 {
|
||||
return false
|
||||
}
|
||||
if msg.Array[0].Type == qbot.Reply {
|
||||
skip++
|
||||
if len(msg.Array) != 1 && msg.Array[1].Type == qbot.At {
|
||||
if len(msg.Array) > 1 && msg.Array[1].Type == qbot.At {
|
||||
skip++
|
||||
}
|
||||
} else if msg.Array[0].Type == qbot.At {
|
||||
|
||||
Reference in New Issue
Block a user