mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-08 12:10:23 +08:00
finish pins
This commit is contained in:
33
openapi_pins.go
Normal file
33
openapi_pins.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package nano
|
||||
|
||||
// PinsMessage 精华消息对象
|
||||
//
|
||||
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/model.html#pinsmessage
|
||||
type PinsMessage struct {
|
||||
GuildID string `json:"guild_id"`
|
||||
ChannelID string `json:"channel_id"`
|
||||
MessageIDs []string `json:"message_ids"`
|
||||
}
|
||||
|
||||
// PinMessageInChannel 添加子频道 channel_id 内的精华消息
|
||||
//
|
||||
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/put_pins_message.html
|
||||
func (bot *Bot) PinMessageInChannel(channelid, messageid string) (*PinsMessage, error) {
|
||||
return bot.putOpenAPIofPinsMessage("/channels/"+channelid+"/pins/"+messageid, nil)
|
||||
}
|
||||
|
||||
// UnpinMessageInChannel 子频道 channel_id 下指定 message_id 的精华消息
|
||||
//
|
||||
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/delete_pins_message.html
|
||||
//
|
||||
// 删除子频道内全部精华消息,请将 message_id 设置为 all
|
||||
func (bot *Bot) UnpinMessageInChannel(channelid, messageid string) error {
|
||||
return bot.DeleteOpenAPI("/channels/"+channelid+"/pins/"+messageid, "", nil)
|
||||
}
|
||||
|
||||
// GetPinMessagesOfChannel 获取子频道 channel_id 内的精华消息
|
||||
//
|
||||
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/get_pins_message.html
|
||||
func (bot *Bot) GetPinMessagesOfChannel(id string) (*PinsMessage, error) {
|
||||
return bot.getOpenAPIofPinsMessage("/channels/" + id + "/pins")
|
||||
}
|
||||
Reference in New Issue
Block a user