mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
coolq: drop [CQ:gift] support
This commit is contained in:
parent
f420c8982e
commit
adec1d1c1b
@ -25,7 +25,6 @@ linters:
|
|||||||
- deadcode
|
- deadcode
|
||||||
- depguard
|
- depguard
|
||||||
- dogsled
|
- dogsled
|
||||||
- dupl
|
|
||||||
- errcheck
|
- errcheck
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- exhaustive
|
- exhaustive
|
||||||
|
@ -106,7 +106,6 @@ go-cqhttp 兼容 [OneBot-v11](https://github.com/botuniverse/onebot-11) 绝大
|
|||||||
| [CQ:image] | [图片] |
|
| [CQ:image] | [图片] |
|
||||||
| [CQ:redbag] | [红包] |
|
| [CQ:redbag] | [红包] |
|
||||||
| [CQ:poke] | [戳一戳] |
|
| [CQ:poke] | [戳一戳] |
|
||||||
| [CQ:gift] | [礼物] |
|
|
||||||
| [CQ:node] | [合并转发消息节点] |
|
| [CQ:node] | [合并转发消息节点] |
|
||||||
| [CQ:cardimage] | [一种 xml 的图片消息(装逼大图)] |
|
| [CQ:cardimage] | [一种 xml 的图片消息(装逼大图)] |
|
||||||
| [CQ:tts] | [文本转语音] |
|
| [CQ:tts] | [文本转语音] |
|
||||||
@ -114,7 +113,6 @@ go-cqhttp 兼容 [OneBot-v11](https://github.com/botuniverse/onebot-11) 绝大
|
|||||||
[图片]: https://docs.go-cqhttp.org/cqcode/#%E5%9B%BE%E7%89%87
|
[图片]: https://docs.go-cqhttp.org/cqcode/#%E5%9B%BE%E7%89%87
|
||||||
[红包]: https://docs.go-cqhttp.org/cqcode/#%E7%BA%A2%E5%8C%85
|
[红包]: https://docs.go-cqhttp.org/cqcode/#%E7%BA%A2%E5%8C%85
|
||||||
[戳一戳]: https://docs.go-cqhttp.org/cqcode/#%E6%88%B3%E4%B8%80%E6%88%B3
|
[戳一戳]: https://docs.go-cqhttp.org/cqcode/#%E6%88%B3%E4%B8%80%E6%88%B3
|
||||||
[礼物]: https://docs.go-cqhttp.org/cqcode/#%E7%A4%BC%E7%89%A9
|
|
||||||
[合并转发消息节点]: https://docs.go-cqhttp.org/cqcode/#%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91%E6%B6%88%E6%81%AF%E8%8A%82%E7%82%B9
|
[合并转发消息节点]: https://docs.go-cqhttp.org/cqcode/#%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91%E6%B6%88%E6%81%AF%E8%8A%82%E7%82%B9
|
||||||
[一种 xml 的图片消息(装逼大图)]: https://docs.go-cqhttp.org/cqcode/#cardimage
|
[一种 xml 的图片消息(装逼大图)]: https://docs.go-cqhttp.org/cqcode/#cardimage
|
||||||
[文本转语音]: https://docs.go-cqhttp.org/cqcode/#%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3
|
[文本转语音]: https://docs.go-cqhttp.org/cqcode/#%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3
|
||||||
|
@ -219,9 +219,6 @@ func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
case *GiftElement:
|
|
||||||
bot.Client.SendGroupGift(uint64(groupID), uint64(i.Target), i.GiftID)
|
|
||||||
return 0
|
|
||||||
case *message.MusicShareElement:
|
case *message.MusicShareElement:
|
||||||
ret, err := bot.Client.SendGroupMusicShare(groupID, i)
|
ret, err := bot.Client.SendGroupMusicShare(groupID, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -355,7 +352,7 @@ func (bot *CQBot) SendGuildChannelMessage(guildID, channelID uint64, m *message.
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
e = n
|
e = n
|
||||||
case *LocalVideoElement, *LocalVoiceElement, *PokeElement, *message.MusicShareElement, *GiftElement:
|
case *LocalVideoElement, *LocalVoiceElement, *PokeElement, *message.MusicShareElement:
|
||||||
log.Warnf("警告: 频道暂不支持发送 %v 消息", i.Type().String())
|
log.Warnf("警告: 频道暂不支持发送 %v 消息", i.Type().String())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,6 @@ type PokeElement struct {
|
|||||||
Target int64
|
Target int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// GiftElement 礼物
|
|
||||||
type GiftElement struct {
|
|
||||||
Target int64
|
|
||||||
GiftID message.GroupGift
|
|
||||||
}
|
|
||||||
|
|
||||||
// LocalImageElement 本地图片
|
// LocalImageElement 本地图片
|
||||||
type LocalImageElement struct {
|
type LocalImageElement struct {
|
||||||
Stream io.ReadSeeker
|
Stream io.ReadSeeker
|
||||||
@ -97,35 +91,11 @@ func (e *LocalImageElement) Type() message.ElementType {
|
|||||||
return message.Image
|
return message.Image
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type 获取元素类型ID
|
|
||||||
func (e *GiftElement) Type() message.ElementType {
|
|
||||||
// Make message.IMessageElement Happy
|
|
||||||
return message.At
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type impl message.IMessageElement
|
// Type impl message.IMessageElement
|
||||||
func (e *LocalVideoElement) Type() message.ElementType {
|
func (e *LocalVideoElement) Type() message.ElementType {
|
||||||
return message.Video
|
return message.Video
|
||||||
}
|
}
|
||||||
|
|
||||||
// GiftID 礼物ID数组
|
|
||||||
var GiftID = [...]message.GroupGift{
|
|
||||||
message.SweetWink,
|
|
||||||
message.HappyCola,
|
|
||||||
message.LuckyBracelet,
|
|
||||||
message.Cappuccino,
|
|
||||||
message.CatWatch,
|
|
||||||
message.FleeceGloves,
|
|
||||||
message.RainbowCandy,
|
|
||||||
message.Stronger,
|
|
||||||
message.LoveMicrophone,
|
|
||||||
message.HoldingYourHand,
|
|
||||||
message.CuteCat,
|
|
||||||
message.MysteryMask,
|
|
||||||
message.ImBusy,
|
|
||||||
message.LoveMask,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type 获取元素类型ID
|
// Type 获取元素类型ID
|
||||||
func (e *PokeElement) Type() message.ElementType {
|
func (e *PokeElement) Type() message.ElementType {
|
||||||
// Make message.IMessageElement Happy
|
// Make message.IMessageElement Happy
|
||||||
@ -918,16 +888,6 @@ func (bot *CQBot) ToElement(t string, d map[string]string, sourceType MessageSou
|
|||||||
case "poke":
|
case "poke":
|
||||||
t, _ := strconv.ParseInt(d["qq"], 10, 64)
|
t, _ := strconv.ParseInt(d["qq"], 10, 64)
|
||||||
return &PokeElement{Target: t}, nil
|
return &PokeElement{Target: t}, nil
|
||||||
case "gift":
|
|
||||||
if sourceType != MessageSourceGroup {
|
|
||||||
return nil, errors.New("private gift unsupported") // no free private gift
|
|
||||||
}
|
|
||||||
t, _ := strconv.ParseInt(d["qq"], 10, 64)
|
|
||||||
id, _ := strconv.Atoi(d["id"])
|
|
||||||
if id < 0 || id >= 14 {
|
|
||||||
return nil, errors.New("invalid gift id")
|
|
||||||
}
|
|
||||||
return &GiftElement{Target: t, GiftID: GiftID[id]}, nil
|
|
||||||
case "tts":
|
case "tts":
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
@ -9,16 +9,15 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Mrs4s/go-cqhttp/db"
|
|
||||||
"github.com/Mrs4s/go-cqhttp/internal/cache"
|
|
||||||
|
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
|
||||||
"github.com/Mrs4s/go-cqhttp/internal/base"
|
|
||||||
|
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"github.com/Mrs4s/MiraiGo/client"
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
"github.com/Mrs4s/MiraiGo/message"
|
"github.com/Mrs4s/MiraiGo/message"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/Mrs4s/go-cqhttp/db"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/internal/base"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/internal/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToFormattedMessage 将给定[]message.IMessageElement转换为通过coolq.SetMessageFormat所定义的消息上报格式
|
// ToFormattedMessage 将给定[]message.IMessageElement转换为通过coolq.SetMessageFormat所定义的消息上报格式
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
- [回复](#回复)
|
- [回复](#回复)
|
||||||
- [红包](#红包)
|
- [红包](#红包)
|
||||||
- [戳一戳](#戳一戳)
|
- [戳一戳](#戳一戳)
|
||||||
- [礼物](#礼物)
|
|
||||||
- [合并转发](#合并转发)
|
- [合并转发](#合并转发)
|
||||||
- [合并转发消息节点](#合并转发消息节点)
|
- [合并转发消息节点](#合并转发消息节点)
|
||||||
- [XML 消息](#xml-消息)
|
- [XML 消息](#xml-消息)
|
||||||
@ -214,42 +213,6 @@ Type: `poke`
|
|||||||
|
|
||||||
示例: `[CQ:poke,qq=123456]`
|
示例: `[CQ:poke,qq=123456]`
|
||||||
|
|
||||||
### 礼物
|
|
||||||
|
|
||||||
> 注意:仅支持免费礼物,发送群礼物消息无法撤回,返回的 `message id` 恒定为 `0`
|
|
||||||
|
|
||||||
Type: `gift`
|
|
||||||
|
|
||||||
范围: **发送(仅群聊,接收的时候不是CQ码)**
|
|
||||||
|
|
||||||
参数:
|
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
|
||||||
| ------ | ----- | -------------- |
|
|
||||||
| `qq` | int64 | 接收礼物的成员 |
|
|
||||||
| `id` | int | 礼物的类型 |
|
|
||||||
|
|
||||||
目前支持的礼物ID:
|
|
||||||
|
|
||||||
| id | 类型 |
|
|
||||||
| --- | ---------- |
|
|
||||||
| 0 | 甜Wink |
|
|
||||||
| 1 | 快乐肥宅水 |
|
|
||||||
| 2 | 幸运手链 |
|
|
||||||
| 3 | 卡布奇诺 |
|
|
||||||
| 4 | 猫咪手表 |
|
|
||||||
| 5 | 绒绒手套 |
|
|
||||||
| 6 | 彩虹糖果 |
|
|
||||||
| 7 | 坚强 |
|
|
||||||
| 8 | 告白话筒 |
|
|
||||||
| 9 | 牵你的手 |
|
|
||||||
| 10 | 可爱猫咪 |
|
|
||||||
| 11 | 神秘面具 |
|
|
||||||
| 12 | 我超忙的 |
|
|
||||||
| 13 | 爱心口罩 |
|
|
||||||
|
|
||||||
示例: `[CQ:gift,qq=123456,id=8]`
|
|
||||||
|
|
||||||
### 合并转发
|
### 合并转发
|
||||||
|
|
||||||
Type: `forward`
|
Type: `forward`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user