22package manager
33
44import (
5+ "strconv"
56 "strings"
67
78 nano "github.com/fumiama/NanoBot"
@@ -17,15 +18,30 @@ func init() {
1718 })
1819 en .OnMessageCommand ("exposeid" ).SetBlock (true ).
1920 Handle (func (ctx * nano.Ctx ) {
20- msg := "*报告*\n - 频道ID: `" + ctx .Message .ChannelID + "`"
21- for _ , e := range strings .Split (ctx .State ["args" ].(string ), " " ) {
22- e = strings .TrimSpace (e )
23- if e == "" {
24- continue
21+ msg := ""
22+ if nano .OnlyQQ (ctx ) {
23+ msg = "*报告*\n - 群ID: `" + strconv .FormatInt (int64 (ctx .GroupID ()), 10 ) + "`"
24+ for _ , e := range strings .Split (ctx .State ["args" ].(string ), " " ) {
25+ e = strings .TrimSpace (e )
26+ if e == "" {
27+ continue
28+ }
29+ if strings .HasPrefix (e , "<@!" ) {
30+ uid := strings .TrimSuffix (e [3 :], ">" )
31+ msg += "\n - 用户: " + e + " ID: `" + uid + "`"
32+ }
2533 }
26- if strings .HasPrefix (e , "<@!" ) {
27- uid := strings .TrimSuffix (e [3 :], ">" )
28- msg += "\n - 用户: " + e + " ID: `" + uid + "`"
34+ } else {
35+ msg = "*报告*\n - 频道ID: `" + ctx .Message .ChannelID + "`"
36+ for _ , e := range strings .Split (ctx .State ["args" ].(string ), " " ) {
37+ e = strings .TrimSpace (e )
38+ if e == "" {
39+ continue
40+ }
41+ if strings .HasPrefix (e , "<@!" ) {
42+ uid := strings .TrimSuffix (e [3 :], ">" )
43+ msg += "\n - 用户: " + e + " ID: `" + uid + "`"
44+ }
2945 }
3046 }
3147 _ , _ = ctx .SendPlainMessage (true , msg )
0 commit comments