Documentation ¶
Index ¶
- Variables
- func ToMessageType(typeName string, msg any) message.MessageType
- type ActionPayload
- type AdminChange
- type AtType
- type CanSendImage
- type CanSendImageResult
- type CanSendRecord
- type CanSendRecordResult
- type CleanCache
- type ContactType
- type DeleteMessage
- type DiceType
- type EmptyResult
- type FaceType
- type FileObject
- type ForwardType
- type FriendAdd
- type FriendPoke
- type FriendRecall
- type FriendRequest
- type GetCookies
- type GetCookiesResult
- type GetCredentials
- type GetCredentialsResult
- type GetCsrfToken
- type GetCsrfTokenResult
- type GetForwardMessage
- type GetForwardMessageResult
- type GetFriendList
- type GetFriendListResult
- type GetGroupHonorInfo
- type GetGroupHonorInfoResult
- type GetGroupInfo
- type GetGroupInfoResult
- type GetGroupList
- type GetGroupListResult
- type GetGroupMemberInfo
- type GetGroupMemberInfoResult
- type GetGroupMemberList
- type GetGroupMemberListResult
- type GetImage
- type GetImageResult
- type GetLoginInfo
- type GetMessage
- type GetMessageResult
- type GetRecord
- type GetRecordResult
- type GetStatus
- type GetStatusResult
- type GetStrangerInfo
- type GetVersionInfo
- type GetVersionInfoResult
- type GroupBan
- type GroupFileUpload
- type GroupHonorChange
- type GroupHonorInfo
- type GroupMemberDecrease
- type GroupMemberIncrease
- type GroupMessage
- type GroupPoke
- type GroupRecall
- type GroupRequest
- type GroupTalkativeInfo
- type JSONType
- type LocationType
- type MusicType
- type NodeType
- type PayloadMessage
- type PokeType
- type PrivateMessage
- type RPSType
- type RedPacketLuckyKing
- type ReplyType
- type SendGroupMessage
- type SendLike
- type SendPrivateMessage
- type SenderObject
- type SetFriendAddRequest
- type SetGroupAddRequest
- type SetGroupAdmin
- type SetGroupBan
- type SetGroupCard
- type SetGroupKick
- type SetGroupLeave
- type SetGroupName
- type SetGroupSpecialTitle
- type SetGroupWholeBan
- type SetRestart
- type ShakeType
- type ShareType
- type XMLType
Constants ¶
This section is empty.
Variables ¶
View Source
var OneBotV11 adapter.Adapter
The adapter for "OneBot v11"
This requires a NTQQ protocol application running aside, like Lagrange.OneBot ¶
And the reverse socket server should be started on 127.0.0.1:21390(ONEBOTV11_HOST in .env file) by default.
You can override the host address to your liking by setting ONEBOTV11_HOST in .env file.
And you should be aware that the host is your gonebot server, not any NTQQ protocol
Functions ¶
func ToMessageType ¶ added in v0.2.0
func ToMessageType(typeName string, msg any) message.MessageType
Convert message.MessageSegment.Data to message.MessageType
Types ¶
type ActionPayload ¶
type AdminChange ¶
type AdminChange struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group_admin" NoticeType string `json:"notice_type"` // "set" or "unset" SubType string `json:"sub_type"` GroupID int64 `json:"group_id"` // Victim ID UserID int64 `json:"user_id"` }
func (AdminChange) AdapterName ¶
func (adminChange AdminChange) AdapterName() string
func (AdminChange) ToRawText ¶
func (adminChanage AdminChange) ToRawText(msg message.MessageSegment) string
func (AdminChange) TypeName ¶
func (adminChange AdminChange) TypeName() string
type CanSendImage ¶
type CanSendImage struct {
CanSendImage int8 `json:"-"`
}
type CanSendImageResult ¶
type CanSendImageResult struct { // Whether the bot can send image Yes bool `json:"yes"` }
type CanSendRecord ¶
type CanSendRecord struct {
CanSendRecord int8 `json:"-"`
}
type CanSendRecordResult ¶
type CanSendRecordResult struct { // Whether the bot can send record Yes bool `json:"yes"` }
type CleanCache ¶
type CleanCache struct {
CleanCache int8 `json:"-"`
}
type ContactType ¶
func (ContactType) AdapterName ¶
func (serializer ContactType) AdapterName() string
func (ContactType) ToRawText ¶
func (contact ContactType) ToRawText(msg message.MessageSegment) string
func (ContactType) TypeName ¶
func (serializer ContactType) TypeName() string
type DeleteMessage ¶
type DeleteMessage struct {
MessageID int64 `json:"message_id"`
}
type FileObject ¶
type ForwardType ¶
type ForwardType struct {
ID string `json:"id"`
}
func (ForwardType) AdapterName ¶
func (serializer ForwardType) AdapterName() string
func (ForwardType) ToRawText ¶
func (forward ForwardType) ToRawText(msg message.MessageSegment) string
func (ForwardType) TypeName ¶
func (serializer ForwardType) TypeName() string
type FriendAdd ¶
type FriendAdd struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "friend_add" NoticeType string `json:"notice_type"` UserID int64 `json:"user_id"` }
func (FriendAdd) AdapterName ¶
type FriendPoke ¶
type FriendPoke struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "notify" NoticeType string `json:"notice_type"` // "poke" SubType string `json:"sub_type"` // Poker ID UserID int64 `json:"user_id"` // Pokee ID TargetID int64 `json:"target_id"` }
func (FriendPoke) AdapterName ¶
func (friendPoke FriendPoke) AdapterName() string
func (FriendPoke) ToRawText ¶
func (friendPoke FriendPoke) ToRawText(msg message.MessageSegment) string
func (FriendPoke) TypeName ¶
func (friendPoke FriendPoke) TypeName() string
type FriendRecall ¶
type FriendRecall struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "friend_recall" NoticeType string `json:"notice_type"` // Recaller ID UserID int64 `json:"user_id"` MessageID int64 `json:"message_id"` }
func (FriendRecall) AdapterName ¶
func (friendRecall FriendRecall) AdapterName() string
func (FriendRecall) ToRawText ¶
func (friendRecall FriendRecall) ToRawText(msg message.MessageSegment) string
func (FriendRecall) TypeName ¶
func (friendRecall FriendRecall) TypeName() string
type FriendRequest ¶
type FriendRequest struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "friend" RequestType string `json:"request_type"` // New friend ID UserId int64 `json:"user_id"` // Request comment Comment string `json:"comment"` // Flag for handling this request Flag string `json:"flag"` }
type GetCookies ¶
type GetCookies struct {
Domain string `json:"domain"`
}
type GetCookiesResult ¶
type GetCookiesResult struct {
Cookies string `json:"cookies"`
}
type GetCredentials ¶
type GetCredentials struct {
Domain string `json:"domain"`
}
type GetCredentialsResult ¶
type GetCsrfToken ¶
type GetCsrfToken struct {
GetCsrfToken int8 `json:"-"`
}
type GetCsrfTokenResult ¶
type GetCsrfTokenResult struct {
CsrfToken int64 `json:"csrf_token"`
}
type GetForwardMessage ¶
type GetForwardMessage struct {
ID string `json:"id"`
}
type GetForwardMessageResult ¶
type GetForwardMessageResult struct {
Message []message.MessageSegment `json:"Message"`
}
type GetFriendList ¶
type GetFriendList struct {
GetFriendList int8 `json:"-"`
}
type GetFriendListResult ¶
type GetGroupHonorInfo ¶
type GetGroupHonorInfoResult ¶
type GetGroupHonorInfoResult struct { GroupID int64 `json:"group_id"` CurrentTalkative GroupTalkativeInfo `json:"current_talkative"` TalkativeList []GroupHonorInfo `json:"talkative_list"` PerformerList []GroupHonorInfo `json:"performer_list"` LegendList []GroupHonorInfo `json:"legend_list"` StrongNewbieList []GroupHonorInfo `json:"strong_newbie_list"` EmotionList []GroupHonorInfo `json:"emotion_list"` }
type GetGroupInfo ¶
type GetGroupInfoResult ¶
type GetGroupList ¶
type GetGroupList struct {
GetGroupList int8 `json:"-"`
}
type GetGroupListResult ¶
type GetGroupListResult []GetGroupInfoResult
type GetGroupMemberInfo ¶
type GetGroupMemberInfoResult ¶
type GetGroupMemberInfoResult struct { // User info GroupID int64 `json:"group_id"` UserID int64 `json:"user_id"` Nickname string `json:"nickname"` Card string `json:"card"` Sex string `json:"sex"` Age int64 `json:"age"` Area string `json:"area"` // Group message info JoinTime int64 `json:"join_time"` LastSentTime int64 `json:"last_sent_time"` Level string `json:"level"` // Group user info // "owner", "admin" or "member" Role string `json:"role"` Unfriendly bool `json:"unfriendly"` Title string `json:"title"` TitleExpireTime int64 `json:"title_expire_time"` CardChangeable bool `json:"card_changeable"` }
type GetGroupMemberList ¶
type GetGroupMemberList struct {
GroupID int64 `json:"group_id"`
}
type GetGroupMemberListResult ¶
type GetGroupMemberListResult []GetGroupMemberInfoResult
type GetImageResult ¶
type GetImageResult struct { // Local file path File string `json:"file"` }
type GetLoginInfo ¶
type GetMessage ¶
type GetMessage struct {
MessageID int64 `json:"message_id"`
}
type GetMessageResult ¶
type GetMessageResult struct { Time int64 `json:"time"` MessageType string `json:"message_type"` MessageID int64 `json:"message_id"` RealID int64 `json:"real_id"` Sender SenderObject `json:"sender"` Message []message.MessageSegment `json:"message"` }
type GetRecord ¶
type GetRecord struct { // File name received File string `json:"file"` // Target format OutFormat string `json:"out_format"` }
To use this, you may need to get ffmpeg installed(the app you are using must support this)
type GetRecordResult ¶
type GetRecordResult struct { // Local file path File string `json:"file"` }
type GetStatusResult ¶
type GetStrangerInfo ¶
type GetVersionInfo ¶
type GetVersionInfo struct {
GetVersionInfo int8 `json:"-"`
}
type GetVersionInfoResult ¶
type GroupBan ¶
type GroupBan struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group_ban" NoticeType string `json:"notice_type"` // "ban" or "lift_ban" SubType string `json:"sub_type"` GroupID int64 `json:"group_id"` OperatorID int64 `json:"operator_id"` // Victim ID UserID int64 `json:"user_id"` Duration int64 `json:"duration"` }
func (GroupBan) AdapterName ¶
type GroupFileUpload ¶
type GroupFileUpload struct { message.MessageType Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group_upload" NoticeType string `json:"notice_type"` GroupID int64 `json:"group_id"` // Sender ID UserID int64 `json:"user_id"` File FileObject `json:"file"` }
func (GroupFileUpload) AdapterName ¶
func (fileUpload GroupFileUpload) AdapterName() string
func (GroupFileUpload) ToRawText ¶
func (fileUpload GroupFileUpload) ToRawText(msg message.MessageSegment) string
func (GroupFileUpload) TypeName ¶
func (fileUpload GroupFileUpload) TypeName() string
type GroupHonorChange ¶
type GroupHonorChange struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "notify" NoticeType string `json:"notice_type"` // "honor" SubType string `json:"sub_type"` // Group ID GroupID int64 `json:"group_id"` // Honoree ID UserID int64 `json:"user_id"` // "talkative", "performer" or "emotion" HonorType string `json:"honor_type"` }
func (GroupHonorChange) AdapterName ¶
func (groupHonorChange GroupHonorChange) AdapterName() string
func (GroupHonorChange) ToRawText ¶
func (groupHonorChange GroupHonorChange) ToRawText(msg message.MessageSegment) string
func (GroupHonorChange) TypeName ¶
func (groupHonorChange GroupHonorChange) TypeName() string
type GroupHonorInfo ¶
type GroupMemberDecrease ¶
type GroupMemberDecrease struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group_decrease" NoticeType string `json:"notice_type"` // "leave" or "kick" or "kick_me" SubType string `json:"sub_type"` GroupID int64 `json:"group_id"` OperatorID int64 `json:"operator_id"` // Victim ID UserID int64 `json:"user_id"` }
func (GroupMemberDecrease) AdapterName ¶
func (groupMemberDecrease GroupMemberDecrease) AdapterName() string
func (GroupMemberDecrease) ToRawText ¶
func (groupMemberDecrease GroupMemberDecrease) ToRawText(msg message.MessageSegment) string
func (GroupMemberDecrease) TypeName ¶
func (groupMemberDecrease GroupMemberDecrease) TypeName() string
type GroupMemberIncrease ¶
type GroupMemberIncrease struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group_increase" NoticeType string `json:"notice_type"` // "approve" or "invite" SubType string `json:"sub_type"` GroupID int64 `json:"group_id"` OperatorID int64 `json:"operator_id"` // Joiner ID UserID int64 `json:"user_id"` }
func (GroupMemberIncrease) AdapterName ¶
func (groupMemberIncrease GroupMemberIncrease) AdapterName() string
func (GroupMemberIncrease) ToRawText ¶
func (groupMemberIncrease GroupMemberIncrease) ToRawText(msg message.MessageSegment) string
func (GroupMemberIncrease) TypeName ¶
func (groupMemberIncrease GroupMemberIncrease) TypeName() string
type GroupMessage ¶
type GroupMessage struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` MessageType string `json:"message_type"` // "normal", "notice" or "active" SubType string `json:"sub_type"` MessageID int64 `json:"message_id"` GroupID int64 `json:"group_id"` UserID int64 `json:"user_id"` Message []PayloadMessage `json:"message"` RawMessage string `json:"raw_message"` Font int64 `json:"font"` Sender SenderObject `json:"sender"` }
type GroupPoke ¶
type GroupPoke struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "notify" NoticeType string `json:"notice_type"` GroupID int64 `json:"group_id"` // "poke" SubType string `json:"sub_type"` // Poker ID UserID int64 `json:"user_id"` // Pokee ID TargetID int64 `json:"target_id"` }
func (GroupPoke) AdapterName ¶
type GroupRecall ¶
type GroupRecall struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group_recall" NoticeType string `json:"notice_type"` GroupID int64 `json:"group_id"` OperatorID int64 `json:"operator_id"` // Recaller ID UserID int64 `json:"user_id"` // Message ID MessageID int64 `json:"message_id"` }
func (GroupRecall) AdapterName ¶
func (groupRecall GroupRecall) AdapterName() string
func (GroupRecall) ToRawText ¶
func (groupRecall GroupRecall) ToRawText(msg message.MessageSegment) string
func (GroupRecall) TypeName ¶
func (groupRecall GroupRecall) TypeName() string
type GroupRequest ¶
type GroupRequest struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "group" RequestType string `json:"request_type"` // "add" or "invite" SubType string `json:"sub_type"` GroupId int64 `json:"group_id"` // Inviter ID UserId int64 `json:"user_id"` // Request comment Comment string `json:"comment"` // Flag for handling this request Flag string `json:"flag"` }
type GroupTalkativeInfo ¶
type LocationType ¶
func (LocationType) AdapterName ¶
func (serializer LocationType) AdapterName() string
func (LocationType) ToRawText ¶
func (location LocationType) ToRawText(msg message.MessageSegment) string
func (LocationType) TypeName ¶
func (serializer LocationType) TypeName() string
type MusicType ¶
type MusicType struct { // "qq", "163", "xm" or "custom" Type string `json:"type"` // Official ID string `json:"id"` // Custom Url string `json:"url"` Audio string `json:"audio"` Title string `json:"title"` Content string `json:"content"` Image string `json:"image"` }
func (MusicType) AdapterName ¶
type NodeType ¶
type NodeType struct { // By ID ID string `json:"id"` // Custom UserID string `json:"user_id"` Nickname string `json:"nickname"` Content []message.MessageSegment `json:"content"` }
Node for forward
func (NodeType) AdapterName ¶
type PayloadMessage ¶
type PokeType ¶
func (PokeType) AdapterName ¶
type PrivateMessage ¶
type PrivateMessage struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` MessageType string `json:"message_type"` // "friend", "group" or "other" SubType string `json:"sub_type"` MessageID int64 `json:"message_id"` UserID int64 `json:"user_id"` Message []PayloadMessage `json:"message"` RawMessage string `json:"raw_message"` Font int64 `json:"font"` Sender SenderObject `json:"sender"` }
type RedPacketLuckyKing ¶
type RedPacketLuckyKing struct { Time int64 `json:"time"` SelfID int64 `json:"self_id"` PostType string `json:"post_type"` // "notify" NoticeType string `json:"notice_type"` // "lucky_king" SubType string `json:"sub_type"` // Group ID GroupID int64 `json:"group_id"` // Red packet sender ID UserID int64 `json:"user_id"` // Lucky king ID TargetID int64 `json:"target_id"` }
func (RedPacketLuckyKing) AdapterName ¶
func (redPacketLuckyKing RedPacketLuckyKing) AdapterName() string
func (RedPacketLuckyKing) ToRawText ¶
func (redPacketLuckyKing RedPacketLuckyKing) ToRawText(msg message.MessageSegment) string
func (RedPacketLuckyKing) TypeName ¶
func (redPacketLuckyKing RedPacketLuckyKing) TypeName() string
type SendGroupMessage ¶
type SendGroupMessage struct { GroupID int64 `json:"group_id"` Message []message.MessageSegment `json:"message"` // True if message is string, false otherwise AutoEscape bool `json:"auto_escape"` }
type SendPrivateMessage ¶
type SendPrivateMessage struct { UserID int64 `json:"user_id"` Message []message.MessageSegment `json:"message"` // True if message is string, false otherwise AutoEscape bool `json:"auto_escape"` }
type SenderObject ¶
type SenderObject struct { UserID int64 `json:"user_id"` Nickname string `json:"nickname"` Sex string `json:"sex"` Age int64 `json:"age"` // If is a group message, SenderObject may also contain the following fields Card string `json:"card"` Area string `json:"area"` Level string `json:"level"` // "owner", "admin" or "member" Role string `json:"Role"` Title string `json:"Title"` }
You shouldn't assume that every field in this struct does exists in actual json string
type SetFriendAddRequest ¶
type SetGroupAddRequest ¶
type SetGroupAddRequest struct { Flag string `json:"flag"` // "add" or "invite", which means the type of the request is add or invite SubType string `json:"sub_type"` // True to approve, false to refuse Approve bool `json:"approve"` // Optional, reason for rejecting the request, only works when approve is false Reason string `json:"reason"` }
type SetGroupAdmin ¶
type SetGroupBan ¶
type SetGroupCard ¶
type SetGroupKick ¶
type SetGroupLeave ¶
type SetGroupName ¶
type SetGroupSpecialTitle ¶
type SetGroupSpecialTitle struct { GroupID int64 `json:"group_id"` UserID int64 `json:"user_id"` // Leave it empty to remove the special title SpecialTitle string `json:"special_title"` // Expiration time, use second as unit, value -1 means no expiration, seems not functioning Duration int64 `json:"duration"` }
type SetGroupWholeBan ¶
type SetRestart ¶
type SetRestart struct { // Milliseconds before restart, if cannot restart normally, try set it to about 2000 Delay int64 `json:"delay"` }
Click to show internal directories.
Click to hide internal directories.