Skip to content

Commit eb117ec

Browse files
committed
examples/receive-and-send: 增加emoji内嵌格式方法
1 parent 7e9046c commit eb117ec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

dto/message/message.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ func MentionChannel(channelID string) string {
4444
return fmt.Sprintf("<#%s>", channelID)
4545
}
4646

47+
// Emoji emoji 内嵌格式,参考 https://bot.q.qq.com/wiki/develop/api/openapi/emoji/model.html
48+
// 只支持 type = 1 的系统表情
49+
func Emoji(ID int) string {
50+
return fmt.Sprintf("<emoji:%d>", ID)
51+
}
52+
4753
// ParseCommand 解析命令,支持 `{cmd} {content}` 的命令格式
4854
func ParseCommand(input string) *CMD {
4955
input = ETLInput(input)

examples/receive-and-send/process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (p Processor) ProcessMessage(input string, data *dto.WSATMessageData) error
1919
ctx := context.Background()
2020
cmd := message.ParseCommand(input)
2121
toCreate := &dto.MessageToCreate{
22-
Content: "默认回复 <emoji:37>",
22+
Content: "默认回复" + message.Emoji(307),
2323
MessageReference: &dto.MessageReference{
2424
// 引用这条消息
2525
MessageID: data.ID,

0 commit comments

Comments
 (0)