github.com/fumiama/NanoBot@v0.0.0-20231122134259-c22d8183efca/openapi_markdown.go (about) 1 package nano 2 3 // MessageMarkdown https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagemarkdown 4 type MessageMarkdown struct { 5 TemplateID int `json:"template_id,omitempty"` 6 CustomTemplateID string `json:"custom_template_id,omitempty"` 7 Params []MessageMarkdownParams `json:"params,omitempty"` 8 Content string `json:"content,omitempty"` // 原生 markdown 内容,与上面三个参数互斥,参数都传值将报错 9 } 10 11 // MessageMarkdownParams https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagemarkdownparams 12 type MessageMarkdownParams struct { 13 Key string `json:"key"` 14 Values []string `json:"values"` 15 } 16 17 // MessageKeyboard https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagekeyboard 18 type MessageKeyboard struct { 19 ID string `json:"id,omitempty"` 20 Content *InlineKeyboard `json:"content,omitempty"` // 自定义 keyboard 内容,与 id 参数互斥,参数都传值将报错 21 } 22 23 // InlineKeyboard 消息按钮对象 24 // 25 // https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html 26 type InlineKeyboard struct { 27 Rows []InlineKeyboardRow `json:"rows"` 28 BotAppID int `json:"bot_appid"` 29 } 30 31 // InlineKeyboardRow https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#inlinekeyboardrow 32 type InlineKeyboardRow struct { 33 Buttons []InlineKeyboardButton `json:"buttons"` 34 } 35 36 // InlineKeyboardButton https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#button 37 type InlineKeyboardButton struct { 38 ID string `json:"id"` 39 RenderData InlineKeyboardButtonRenderData `json:"render_data"` 40 Action InlineKeyboardButtonAction `json:"action"` 41 } 42 43 // InlineKeyboardButtonRenderDataStyle https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#renderstyle 44 type InlineKeyboardButtonRenderDataStyle int 45 46 const ( 47 InlineKeyboardButtonRenderDataStyleGray InlineKeyboardButtonRenderDataStyle = iota 48 InlineKeyboardButtonRenderDataStyleBlue 49 ) 50 51 // InlineKeyboardButtonRenderData https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#renderdata 52 type InlineKeyboardButtonRenderData struct { 53 Label string `json:"label"` 54 VisitedLabel string `json:"visited_label"` 55 Style InlineKeyboardButtonRenderDataStyle `json:"style"` 56 } 57 58 // InlineKeyboardButtonActionType https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#actiontype 59 type InlineKeyboardButtonActionType int 60 61 const ( 62 InlineKeyboardButtonActionTypeHTTP InlineKeyboardButtonActionType = iota 63 InlineKeyboardButtonActionTypeCallback 64 InlineKeyboardButtonActionTypeAtBot 65 ) 66 67 // InlineKeyboardButtonAction https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#action 68 type InlineKeyboardButtonAction struct { 69 Type InlineKeyboardButtonActionType `json:"type"` 70 Permission InlineKeyboardButtonActionPermission `json:"permission"` 71 ClickLimit int `json:"click_limit"` 72 UnsupportTips string `json:"unsupport_tips"` 73 Data string `json:"data"` 74 AtBotShowChannelList bool `json:"at_bot_show_channel_list"` 75 } 76 77 // InlineKeyboardButtonActionPermissionType https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#permissiontype 78 type InlineKeyboardButtonActionPermissionType int 79 80 const ( 81 InlineKeyboardButtonActionPermissionTypeShimeiUser InlineKeyboardButtonActionPermissionType = iota 82 InlineKeyboardButtonActionPermissionTypeAdmin 83 InlineKeyboardButtonActionPermissionTypeAll 84 InlineKeyboardButtonActionPermissionTypeShimeiRole 85 ) 86 87 // InlineKeyboardButtonActionPermission https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#permission 88 type InlineKeyboardButtonActionPermission struct { 89 Type InlineKeyboardButtonActionPermissionType `json:"type"` 90 SpecifyRoleIDs []string `json:"specify_role_ids"` 91 SpecifyUserIDs []string `json:"specify_user_ids"` 92 }