mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-08 04:55:55 +08:00
add: poke sending.
This commit is contained in:
parent
fef9395890
commit
741a91cf70
@ -139,6 +139,14 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
|
||||
newElem = append(newElem, gv)
|
||||
continue
|
||||
}
|
||||
if i, ok := elem.(*PokeElement); ok {
|
||||
if group := bot.Client.FindGroup(groupId); group != nil {
|
||||
if mem := group.FindMember(i.Target); mem != nil {
|
||||
mem.Poke()
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
newElem = append(newElem, elem)
|
||||
}
|
||||
m.Elements = newElem
|
||||
|
@ -26,6 +26,14 @@ var paramReg = regexp.MustCompile(`,([\w\-.]+?)=([^,\]]+)`)
|
||||
|
||||
var IgnoreInvalidCQCode = false
|
||||
|
||||
type PokeElement struct {
|
||||
Target int64
|
||||
}
|
||||
|
||||
func (e *PokeElement) Type() message.ElementType {
|
||||
return message.At
|
||||
}
|
||||
|
||||
func ToArrayMessage(e []message.IMessageElement, code int64, raw ...bool) (r []MSG) {
|
||||
ur := false
|
||||
if len(raw) != 0 {
|
||||
@ -319,6 +327,12 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
||||
return message.NewText(d["text"]), nil
|
||||
case "image":
|
||||
return bot.makeImageElem(t, d, group)
|
||||
case "poke":
|
||||
if !group {
|
||||
return nil, errors.New("todo") // TODO: private poke
|
||||
}
|
||||
t, _ := strconv.ParseInt(d["qq"], 10, 64)
|
||||
return &PokeElement{Target: t}, nil
|
||||
case "record":
|
||||
if !group {
|
||||
return nil, errors.New("private voice unsupported now")
|
||||
|
@ -32,6 +32,20 @@ Type: `redbag`
|
||||
|
||||
示例: `[CQ:redbag,title=恭喜发财]`
|
||||
|
||||
### 戳一戳
|
||||
|
||||
Type: `poke`
|
||||
|
||||
范围: **发送(仅群聊)**
|
||||
|
||||
参数:
|
||||
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ------ | ------ | ----------- |
|
||||
| qq | int64 | 需要戳的成员 |
|
||||
|
||||
示例: `[CQ:poke,qq=123456]`
|
||||
|
||||
### 合并转发
|
||||
|
||||
Type: `forward`
|
||||
|
Loading…
x
Reference in New Issue
Block a user