Documentation ¶
Index ¶
- Constants
- Variables
- type Attachment
- type AudioMessageContext
- type AudioMessageEventHandler
- type BlacklistCreate
- type BlacklistItem
- type BlockListAddContext
- type BlockListAddEventHandler
- type BlockListDeleteContext
- type BlockListDeleteEventHandler
- type BotExitContext
- type BotExitEventHandler
- type BotJoinContext
- type BotJoinEventHandler
- type CardMessage
- type CardMessageActionGroup
- type CardMessageCard
- type CardMessageContainer
- type CardMessageContext
- type CardMessageCountdown
- type CardMessageCountdownMode
- type CardMessageDivider
- type CardMessageElementButton
- type CardMessageElementButtonClick
- type CardMessageElementImage
- type CardMessageElementKMarkdown
- type CardMessageElementText
- type CardMessageFile
- type CardMessageFileType
- type CardMessageHeader
- type CardMessageImageGroup
- type CardMessageInvite
- type CardMessageParagraph
- type CardMessageSection
- type CardMessageSectionMode
- type CardSize
- type CardTheme
- type Channel
- type ChannelAddContext
- type ChannelAddEventHandler
- type ChannelCreate
- type ChannelDeleteContext
- type ChannelDeleteEventHandler
- type ChannelMessage
- type ChannelRoleBase
- type ChannelRoleCreate
- type ChannelRoleCreateResp
- type ChannelRoleDelete
- type ChannelRoleIndex
- type ChannelRoleUpdate
- type ChannelRoleUpdateResp
- type ChannelType
- type ChannelUpdateContext
- type ChannelUpdateEventHandler
- type DetailedChannelMessage
- type DirectMessageCreate
- type DirectMessageCreateOption
- type DirectMessageDeleteContext
- type DirectMessageDeleteEventHandler
- type DirectMessageListOption
- type DirectMessageReactionAddContext
- type DirectMessageReactionAddEventHandler
- type DirectMessageReactionDeleteContext
- type DirectMessageReactionDeleteEventHandler
- type DirectMessageResp
- type DirectMessageUpdate
- type DirectMessageUpdateContext
- type DirectMessageUpdateEventHandler
- type EmojiItem
- type EndpointGeneralResponse
- type Entry
- type Event
- type EventCardMessageContext
- type EventCardMessageEventHandler
- type EventContext
- type EventCustomMessage
- type EventData
- type EventDataGeneral
- type EventDataHello
- type EventDataResumeAck
- type EventDataSystem
- type EventDirectChatReactionItem
- type EventGuild
- type EventGuildMemberOnlineItem
- type EventHandler
- type EventHandlerCommonContext
- type EventHandlerProvider
- type EventKmarkdown
- type EventMentionPart
- type EventMentionRolePart
- type EventPinMessageItem
- type EventReactionItem
- type EventRichMessage
- type EventSignal
- type EventStatusCode
- type FileMessageContext
- type FileMessageEventHandler
- type Game
- type GameCreate
- type GameType
- type GameUpdate
- type GeneralListData
- type Guild
- type GuildChannelMemberAddContext
- type GuildChannelMemberAddEventHandler
- type GuildChannelMemberDeleteContext
- type GuildChannelMemberDeleteEventHandler
- type GuildDeleteContext
- type GuildDeleteEventHandler
- type GuildEmojiResp
- type GuildMemberAddContext
- type GuildMemberAddEventHandler
- type GuildMemberDeleteContext
- type GuildMemberDeleteEventHandler
- type GuildMemberOfflineContext
- type GuildMemberOfflineEventHandler
- type GuildMemberOnlineContext
- type GuildMemberOnlineEventHandler
- type GuildMemberUpdateContext
- type GuildMemberUpdateEventHandler
- type GuildMuteList
- type GuildMuteSetting
- type GuildNickname
- type GuildNotifyType
- type GuildRoleAddContext
- type GuildRoleAddEventHandler
- type GuildRoleDeleteContext
- type GuildRoleDeleteEventHandler
- type GuildRoleResp
- type GuildRoleUpdateContext
- type GuildRoleUpdateEventHandler
- type GuildUpdateContext
- type GuildUpdateEventHandler
- type GuildUserListInfo
- type GuildUserListOption
- func GuildUserListWithActiveTime(activeTime bool) GuildUserListOption
- func GuildUserListWithChannelID(id string) GuildUserListOption
- func GuildUserListWithJoinedAt(joinedAt bool) GuildUserListOption
- func GuildUserListWithMobileVerified(verified bool) GuildUserListOption
- func GuildUserListWithRoleID(roleID int64) GuildUserListOption
- func GuildUserListWithSearch(search string) GuildUserListOption
- type Identify
- type ImageMessageContext
- type ImageMessageEventHandler
- type IntBool
- type IntimacyIndexResp
- type IntimacyUpdate
- type InviteCreate
- type InviteDelete
- type InviteDuration
- type InviteListOption
- type InviteListResp
- type InviteSettingTimes
- type KmarkdownMessageContext
- type KmarkdownMessageEventHandler
- type Logger
- type MessageButtonClickContext
- type MessageButtonClickEventHandler
- type MessageCreate
- type MessageCreateBase
- type MessageCreateOption
- type MessageDeleteContext
- type MessageDeleteEventHandler
- type MessageListFlag
- type MessageListOption
- type MessagePinContext
- type MessagePinEventHandler
- type MessageReaction
- type MessageResp
- type MessageType
- type MessageUnpinContext
- type MessageUnpinEventHandler
- type MessageUpdate
- type MessageUpdateBase
- type MessageUpdateContext
- type MessageUpdateEventHandler
- type MessageWithAttachment
- type MilliTimeStamp
- type MuteType
- type PageInfo
- type PageSetting
- type PermissionOverwrite
- type PrivateMessage
- type Quote
- type ReactedUser
- type ReactionAddContext
- type ReactionAddEventHandler
- type ReactionDeleteContext
- type ReactionDeleteEventHandler
- type ReactionItem
- type ReplyOption
- type RestError
- type Role
- type RolePermission
- type Session
- func (s *Session) AddHandler(h interface{}) func()
- func (s *Session) AssetCreate(name string, file []byte) (url string, err error)
- func (s *Session) BadgeGuildUrl(guildID string, style int) string
- func (s *Session) BlacklistCreate(bc *BlacklistCreate) (err error)
- func (s *Session) BlacklistDelete(guildID, targetID string) (err error)
- func (s *Session) BlacklistList(guildID string, page *PageSetting) (bi []*BlacklistItem, meta *PageInfo, err error)
- func (s *Session) ChannelCreate(cc *ChannelCreate) (c *Channel, err error)
- func (s *Session) ChannelDelete(channelID string) (err error)
- func (s *Session) ChannelList(guildID string, page *PageSetting) (cs []*Channel, meta *PageInfo, err error)
- func (s *Session) ChannelMoveUsers(targetChannelID string, userIDs []string) (err error)
- func (s *Session) ChannelRoleCreate(crc *ChannelRoleCreate) (crcr *ChannelRoleCreateResp, err error)
- func (s *Session) ChannelRoleDelete(crd *ChannelRoleDelete) (err error)
- func (s *Session) ChannelRoleIndex(channelID string) (cr *ChannelRoleIndex, err error)
- func (s *Session) ChannelRoleUpdate(cru *ChannelRoleUpdate) (crur *ChannelRoleUpdateResp, err error)
- func (s *Session) ChannelUserGetJoinedChannel(guildID, userID string, page *PageSetting) (us []*UserInVoiceChannel, meta *PageInfo, err error)
- func (s *Session) ChannelView(channelID string) (c *Channel, err error)
- func (s *Session) Close() (err error)
- func (s *Session) CloseWithCode(code int) (err error)
- func (s *Session) DirectMessageAddReaction(msgID, emoji string) (err error)
- func (s *Session) DirectMessageCreate(create *DirectMessageCreate) (mr *MessageResp, err error)
- func (s *Session) DirectMessageDelete(msgID string) (err error)
- func (s *Session) DirectMessageDeleteReaction(msgID, emoji string) (err error)
- func (s *Session) DirectMessageList(options ...DirectMessageListOption) (dmrs []*DirectMessageResp, err error)
- func (s *Session) DirectMessageReactionList(msgID, emoji string) (us []*ReactedUser, err error)
- func (s *Session) DirectMessageUpdate(update *DirectMessageUpdate) (err error)
- func (s *Session) GameActivity(id int64) (err error)
- func (s *Session) GameCreate(gc *GameCreate) (g *Game, err error)
- func (s *Session) GameDelete(id int64) (err error)
- func (s *Session) GameDeleteActivity() (err error)
- func (s *Session) GameList(page *PageSetting) (gs []*Game, meta *PageInfo, err error)
- func (s *Session) GameUpdate(gu *GameUpdate) (g *Game, err error)
- func (s *Session) Gateway() (gateway string, err error)
- func (s *Session) GuildEmojiCreate(name, guildID string, emoji []byte) (ger *GuildEmojiResp, err error)
- func (s *Session) GuildEmojiDelete(id string) (err error)
- func (s *Session) GuildEmojiList(guildID string, page *PageSetting) (gers []*GuildEmojiResp, meta *PageInfo, err error)
- func (s *Session) GuildEmojiUpdate(name, id string) (err error)
- func (s *Session) GuildKickout(guildID, targetID string) (err error)
- func (s *Session) GuildLeave(guildID string) (err error)
- func (s *Session) GuildList(page *PageSetting) (gs []*Guild, meta *PageInfo, err error)
- func (s *Session) GuildMuteCreate(gms *GuildMuteSetting) (err error)
- func (s *Session) GuildMuteDelete(gms *GuildMuteSetting) (err error)
- func (s *Session) GuildMuteList(guildID string) (gml *GuildMuteList, err error)
- func (s *Session) GuildNickname(gn *GuildNickname) (err error)
- func (s *Session) GuildRoleCreate(name, guildID string) (r *Role, err error)
- func (s *Session) GuildRoleDelete(guildID, roleID string) (err error)
- func (s *Session) GuildRoleGrant(guildID, userID string, roleID int64) (grr *GuildRoleResp, err error)
- func (s *Session) GuildRoleList(guildID string, page *PageSetting) (rs []*Role, meta *PageInfo, err error)
- func (s *Session) GuildRoleRevoke(guildID, userID string, roleID int64) (grr *GuildRoleResp, err error)
- func (s *Session) GuildRoleUpdate(guildID string, role *Role) (r *Role, err error)
- func (s *Session) GuildUserList(guildID string, page *PageSetting, options ...GuildUserListOption) (us []*User, guli *GuildUserListInfo, meta *PageInfo, err error)
- func (s *Session) GuildView(guildID string) (g *Guild, err error)
- func (s *Session) IntimacyIndex(userID string) (iir *IntimacyIndexResp, err error)
- func (s *Session) IntimacyUpdate(iu *IntimacyUpdate) (err error)
- func (s *Session) InviteCreate(ic *InviteCreate) (URL string, err error)
- func (s *Session) InviteDelete(id *InviteDelete) (err error)
- func (s *Session) InviteList(page *PageSetting, options ...InviteListOption) (ilrs []*InviteListResp, meta *PageInfo, err error)
- func (s *Session) MessageAddReaction(msgID, emoji string) (err error)
- func (s *Session) MessageCreate(m *MessageCreate) (resp *MessageResp, err error)
- func (s *Session) MessageDelete(msgID string) (err error)
- func (s *Session) MessageDeleteReaction(msgID, emoji string, userID string) (err error)
- func (s *Session) MessageList(targetID string, options ...MessageListOption) (ms []*DetailedChannelMessage, err error)
- func (s *Session) MessageReactionList(msgID, emoji string) (us []*ReactedUser, err error)
- func (s *Session) MessageUpdate(m *MessageUpdate) (err error)
- func (s *Session) Open() (err error)
- func (s *Session) Request(method, url string, data interface{}) (response []byte, err error)
- func (s *Session) RequestWithPage(method, u string, page *PageSetting) (response []byte, meta *PageInfo, err error)
- func (s *Session) UserChatCreate(UserID string) (uc *UserChat, err error)
- func (s *Session) UserChatDelete(ChatCode string) (err error)
- func (s *Session) UserChatList(page *PageSetting) (ucs []*UserChat, meta *PageInfo, err error)
- func (s *Session) UserChatView(chatCode string) (uc *UserChat, err error)
- func (s *Session) UserMe() (u *User, err error)
- func (s *Session) UserOffline() error
- func (s *Session) UserView(userID string, options ...UserViewOption) (u *User, err error)
- func (s *Session) WebhookHandler() http.HandlerFunc
- type SessionOption
- type SnStore
- type TextMessageContext
- type TextMessageEventHandler
- type User
- type UserChat
- type UserInVoiceChannel
- type UserPermissionOverwrite
- type UserStatus
- type UserUpdateContext
- type UserUpdateEventHandler
- type UserViewOption
- type VideoMessageContext
- type VideoMessageEventHandler
Constants ¶
const ( GameTypeGame = iota GameTypeVup GameTypeProcess )
These are all GameType values.
Variables ¶
var ( APIVersion = "v3" EndpointBase = "https://www.kaiheila.cn/api" EndpointAPI = urlJoin(EndpointBase, APIVersion) EndpointGuild = urlJoin(EndpointAPI, "guild") EndpointGuildMute = urlJoin(EndpointAPI, "guild-mute") EndpointChannel = urlJoin(EndpointAPI, "channel") EndpointChannelRole = urlJoin(EndpointAPI, "channel-role") EndpointChannelUser = urlJoin(EndpointAPI, "channel-user") EndpointMessage = urlJoin(EndpointAPI, "message") EndpointUserChat = urlJoin(EndpointAPI, "user-chat") EndpointDirectMessage = urlJoin(EndpointAPI, "direct-message") EndpointGateway = urlJoin(EndpointAPI, "gateway") EndpointUser = urlJoin(EndpointAPI, "user") EndpointAsset = urlJoin(EndpointAPI, "asset") EndpointGuildRole = urlJoin(EndpointAPI, "guild-role") EndpointIntimacy = urlJoin(EndpointAPI, "intimacy") EndpointGuildEmoji = urlJoin(EndpointAPI, "guild-emoji") EndpointInvite = urlJoin(EndpointAPI, "invite") EndpointBlacklist = urlJoin(EndpointAPI, "blacklist") EndpointBadge = urlJoin(EndpointAPI, "badge") EndpointGame = urlJoin(EndpointAPI, "game") EndpointGuildList = urlJoin(EndpointGuild, "list") EndpointGuildView = urlJoin(EndpointGuild, "view") EndpointGuildUserList = urlJoin(EndpointGuild, "user-list") EndpointGuildNickName = urlJoin(EndpointGuild, "nickname") EndpointGuildLeave = urlJoin(EndpointGuild, "leave") EndpointGuildKickout = urlJoin(EndpointGuild, "kickout") EndpointGuildMuteList = urlJoin(EndpointGuildMute, "list") EndpointGuildMuteCreate = urlJoin(EndpointGuildMute, "create") EndpointGuildMuteDelete = urlJoin(EndpointGuildMute, "delete") // EndpointChannelMessage is Deprecated. EndpointChannelMessage = urlJoin(EndpointChannel, "message") EndpointChannelList = urlJoin(EndpointChannel, "list") EndpointChannelView = urlJoin(EndpointChannel, "view") EndpointChannelCreate = urlJoin(EndpointChannel, "create") EndpointChannelMoveUser = urlJoin(EndpointChannel, "move-user") EndpointChannelDelete = urlJoin(EndpointChannel, "delete") EndpointChannelRoleIndex = urlJoin(EndpointChannelRole, "index") EndpointChannelRoleCreate = urlJoin(EndpointChannelRole, "create") EndpointChannelRoleUpdate = urlJoin(EndpointChannelRole, "update") EndpointChannelRoleDelete = urlJoin(EndpointChannelRole, "delete") EndpointChannelUserGetJoinedChannel = urlJoin(EndpointChannelUser, "get-joined-channel") EndpointMessageList = urlJoin(EndpointMessage, "list") EndpointMessageCreate = urlJoin(EndpointMessage, "create") EndpointMessageUpdate = urlJoin(EndpointMessage, "update") EndpointMessageDelete = urlJoin(EndpointMessage, "delete") EndpointMessageReactionList = urlJoin(EndpointMessage, "reaction-list") EndpointMessageAddReaction = urlJoin(EndpointMessage, "add-reaction") EndpointMessageDeleteReaction = urlJoin(EndpointMessage, "delete-reaction") EndpointUserChatList = urlJoin(EndpointUserChat, "list") EndpointUserChatView = urlJoin(EndpointUserChat, "view") EndpointUserChatCreate = urlJoin(EndpointUserChat, "create") EndpointUserChatDelete = urlJoin(EndpointUserChat, "delete") EndpointDirectMessageList = urlJoin(EndpointDirectMessage, "list") EndpointDirectMessageCreate = urlJoin(EndpointDirectMessage, "create") EndpointDirectMessageUpdate = urlJoin(EndpointDirectMessage, "update") EndpointDirectMessageDelete = urlJoin(EndpointDirectMessage, "delete") EndpointDirectMessageReactionList = urlJoin(EndpointDirectMessage, "reaction-list") EndpointDirectMessageAddReaction = urlJoin(EndpointDirectMessage, "add-reaction") EndpointDirectMessageDeleteReaction = urlJoin(EndpointDirectMessage, "delete-reaction") EndpointGatewayIndex = urlJoin(EndpointGateway, "index") EndpointUserMe = urlJoin(EndpointUser, "me") EndpointUserView = urlJoin(EndpointUser, "view") EndpointUserOffline = urlJoin(EndpointUser, "offline") EndpointAssetCreate = urlJoin(EndpointAsset, "create") EndpointGuildRoleList = urlJoin(EndpointGuildRole, "list") EndpointGuildRoleCreate = urlJoin(EndpointGuildRole, "create") EndpointGuildRoleUpdate = urlJoin(EndpointGuildRole, "update") EndpointGuildRoleDelete = urlJoin(EndpointGuildRole, "delete") EndpointGuildRoleGrant = urlJoin(EndpointGuildRole, "grant") EndpointGuildRoleRevoke = urlJoin(EndpointGuildRole, "revoke") EndpointIntimacyIndex = urlJoin(EndpointIntimacy, "index") EndpointIntimacyUpdate = urlJoin(EndpointIntimacy, "update") EndpointGuildEmojiList = urlJoin(EndpointGuildEmoji, "list") EndpointGuildEmojiCreate = urlJoin(EndpointGuildEmoji, "create") EndpointGuildEmojiUpdate = urlJoin(EndpointGuildEmoji, "update") EndpointGuildEmojiDelete = urlJoin(EndpointGuildEmoji, "delete") EndpointInviteList = urlJoin(EndpointInvite, "list") EndpointInviteCreate = urlJoin(EndpointInvite, "create") EndpointInviteDelete = urlJoin(EndpointInvite, "delete") EndpointBlacklistList = urlJoin(EndpointBlacklist, "list") EndpointBlacklistCreate = urlJoin(EndpointBlacklist, "create") EndpointBlacklistDelete = urlJoin(EndpointBlacklist, "delete") EndpointBadgeGuild = urlJoin(EndpointBadge, "guild") EndpointGameCreate = urlJoin(EndpointGame, "create") EndpointGameUpdate = urlJoin(EndpointGame, "update") EndpointGameDelete = urlJoin(EndpointGame, "delete") EndpointGameActivity = urlJoin(EndpointGame, "activity") EndpointGameDeleteActivity = urlJoin(EndpointGame, "delete-activity") )
All endpoints for http request
var ErrWSAlreadyOpen = errors.New("websocket is already opened")
ErrWSAlreadyOpen is the error when connecting with connected websocket.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { Type string `json:"type"` URL string `json:"url"` Name string `json:"name"` FileType string `json:"file_type"` Size int64 `json:"size"` Duration float64 `json:"duration"` Width int `json:"width"` Height int `json:"height"` }
Attachment is the struct for various attachments, so that according to type, some fields may be empty.
type AudioMessageContext ¶ added in v0.0.4
type AudioMessageContext struct { *EventHandlerCommonContext Extra EventRichMessage }
func (*AudioMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *AudioMessageContext) GetCommon() *EventHandlerCommonContext
func (*AudioMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *AudioMessageContext) GetExtra() interface{}
type AudioMessageEventHandler ¶ added in v0.0.4
type AudioMessageEventHandler func(*AudioMessageContext)
func (AudioMessageEventHandler) Handle ¶ added in v0.0.4
func (eh AudioMessageEventHandler) Handle(i EventContext)
func (AudioMessageEventHandler) New ¶ added in v0.0.4
func (eh AudioMessageEventHandler) New() EventContext
func (AudioMessageEventHandler) Type ¶ added in v0.0.4
func (eh AudioMessageEventHandler) Type() string
type BlacklistCreate ¶ added in v0.0.20
type BlacklistCreate struct { GuildID string `json:"guild_id"` TargetID string `json:"target_id"` Remark string `json:"remark,omitempty"` DelMsgDays int `json:"del_msg_days,omitempty"` }
BlacklistCreate is the type for arguments of BlacklistCreate request.
type BlacklistItem ¶ added in v0.0.20
type BlacklistItem struct { UserID string `json:"user_id"` CreatedTime MilliTimeStamp `json:"created_time"` Remark string `json:"remark"` User *User `json:"user"` }
BlacklistItem is one user in blacklist.
type BlockListAddContext ¶ added in v0.0.4
type BlockListAddContext struct { *EventHandlerCommonContext Extra struct { OperatorID string `json:"operator_id"` Remark string `json:"remark"` UserID []string `json:"user_id"` } }
func (*BlockListAddContext) GetCommon ¶ added in v0.0.4
func (ctx *BlockListAddContext) GetCommon() *EventHandlerCommonContext
func (*BlockListAddContext) GetExtra ¶ added in v0.0.4
func (ctx *BlockListAddContext) GetExtra() interface{}
type BlockListAddEventHandler ¶ added in v0.0.4
type BlockListAddEventHandler func(*BlockListAddContext)
func (BlockListAddEventHandler) Handle ¶ added in v0.0.4
func (eh BlockListAddEventHandler) Handle(i EventContext)
func (BlockListAddEventHandler) New ¶ added in v0.0.4
func (eh BlockListAddEventHandler) New() EventContext
func (BlockListAddEventHandler) Type ¶ added in v0.0.4
func (eh BlockListAddEventHandler) Type() string
type BlockListDeleteContext ¶ added in v0.0.4
type BlockListDeleteContext struct { *EventHandlerCommonContext Extra struct { OperatorID string `json:"operator_id"` UserID []string `json:"user_id"` } }
func (*BlockListDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *BlockListDeleteContext) GetCommon() *EventHandlerCommonContext
func (*BlockListDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *BlockListDeleteContext) GetExtra() interface{}
type BlockListDeleteEventHandler ¶ added in v0.0.4
type BlockListDeleteEventHandler func(*BlockListDeleteContext)
func (BlockListDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh BlockListDeleteEventHandler) Handle(i EventContext)
func (BlockListDeleteEventHandler) New ¶ added in v0.0.4
func (eh BlockListDeleteEventHandler) New() EventContext
func (BlockListDeleteEventHandler) Type ¶ added in v0.0.4
func (eh BlockListDeleteEventHandler) Type() string
type BotExitContext ¶ added in v0.0.4
type BotExitContext struct { *EventHandlerCommonContext Extra struct { GuildID string `json:"guild_id"` } }
func (*BotExitContext) GetCommon ¶ added in v0.0.4
func (ctx *BotExitContext) GetCommon() *EventHandlerCommonContext
func (*BotExitContext) GetExtra ¶ added in v0.0.4
func (ctx *BotExitContext) GetExtra() interface{}
type BotExitEventHandler ¶ added in v0.0.4
type BotExitEventHandler func(*BotExitContext)
func (BotExitEventHandler) Handle ¶ added in v0.0.4
func (eh BotExitEventHandler) Handle(i EventContext)
func (BotExitEventHandler) New ¶ added in v0.0.4
func (eh BotExitEventHandler) New() EventContext
func (BotExitEventHandler) Type ¶ added in v0.0.4
func (eh BotExitEventHandler) Type() string
type BotJoinContext ¶ added in v0.0.4
type BotJoinContext struct { *EventHandlerCommonContext Extra struct { GuildID string `json:"guild_id"` } }
func (*BotJoinContext) GetCommon ¶ added in v0.0.4
func (ctx *BotJoinContext) GetCommon() *EventHandlerCommonContext
func (*BotJoinContext) GetExtra ¶ added in v0.0.4
func (ctx *BotJoinContext) GetExtra() interface{}
type BotJoinEventHandler ¶ added in v0.0.4
type BotJoinEventHandler func(*BotJoinContext)
func (BotJoinEventHandler) Handle ¶ added in v0.0.4
func (eh BotJoinEventHandler) Handle(i EventContext)
func (BotJoinEventHandler) New ¶ added in v0.0.4
func (eh BotJoinEventHandler) New() EventContext
func (BotJoinEventHandler) Type ¶ added in v0.0.4
func (eh BotJoinEventHandler) Type() string
type CardMessage ¶
type CardMessage []*CardMessageCard
CardMessage is the type for a message of cards called 卡片消息.
func (CardMessage) BuildMessage ¶
func (c CardMessage) BuildMessage() (s string, err error)
BuildMessage is a helper function to marshal card message for sending.
func (CardMessage) MustBuildMessage ¶
func (c CardMessage) MustBuildMessage() string
MustBuildMessage is a helper function to marshal card message for sending.
type CardMessageActionGroup ¶
type CardMessageActionGroup []CardMessageElementButton
CardMessageActionGroup is the type for 模块-交互模块.
func (CardMessageActionGroup) MarshalJSON ¶
func (c CardMessageActionGroup) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageCard ¶
type CardMessageCard struct { Theme CardTheme `json:"theme,omitempty"` Color string `json:"color,omitempty"` Size CardSize `json:"size,omitempty"` Modules []interface{} `json:"modules"` }
CardMessageCard is the type for 卡片.
func (*CardMessageCard) AddModule ¶
func (c *CardMessageCard) AddModule(i ...interface{}) *CardMessageCard
AddModule adds Modules to a card and provides a runtime type check for CardMessageCard Modules.
Allowed Modules: *CardMessageHeader, *CardMessageSection, *CardMessageImageGroup, *CardMessageContainer, *CardMessageActionGroup, *CardMessageContext, *CardMessageDivider, *CardMessageFile, *CardMessageCountdown.
func (CardMessageCard) MarshalJSON ¶
func (c CardMessageCard) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageContainer ¶ added in v0.0.14
type CardMessageContainer []CardMessageElementImage
CardMessageContainer is the type for 可拓展图片模块.
func (*CardMessageContainer) AddElements ¶ added in v0.0.14
func (c *CardMessageContainer) AddElements(i ...CardMessageElementImage) *CardMessageContainer
AddElements adds elements to container.
func (CardMessageContainer) MarshalJSON ¶ added in v0.0.14
func (c CardMessageContainer) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling.
type CardMessageContext ¶
type CardMessageContext []interface{}
CardMessageContext is the type for 模块-备注模块.
func (*CardMessageContext) AddItem ¶
func (c *CardMessageContext) AddItem(i ...interface{}) *CardMessageContext
AddItem provides additional type-checking when adding elements to context.
Allowed elements: *CardMessageElementText, *CardMessageElementKMarkdown, *CardMessageElementImage
func (CardMessageContext) MarshalJSON ¶
func (c CardMessageContext) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageCountdown ¶
type CardMessageCountdown struct { EndTime MilliTimeStamp `json:"endTime"` StartTime MilliTimeStamp `json:"startTime"` Mode CardMessageCountdownMode `json:"mode"` }
CardMessageCountdown is the type for 模块-倒计时模块.
func (CardMessageCountdown) MarshalJSON ¶
func (c CardMessageCountdown) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageCountdownMode ¶ added in v0.0.17
type CardMessageCountdownMode string
CardMessageCountdownMode is the type for modes of CardMessageCountdown
const ( CardMessageCountdownModeDay CardMessageCountdownMode = "day" CardMessageCountdownModeHour CardMessageCountdownMode = "hour" CardMessageCountdownModeSecond CardMessageCountdownMode = "second" )
These are predefined usable CardMessageCountdownModes
type CardMessageDivider ¶
type CardMessageDivider struct { }
CardMessageDivider is the type for 模块-分割线模块.
func (CardMessageDivider) MarshalJSON ¶
func (c CardMessageDivider) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageElementButton ¶
type CardMessageElementButton struct { Theme CardTheme `json:"theme"` Value string `json:"value"` Click string `json:"click,omitempty"` Text string `json:"text"` }
CardMessageElementButton is the type for 元素-按钮.
func (CardMessageElementButton) MarshalJSON ¶
func (c CardMessageElementButton) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageElementButtonClick ¶ added in v0.0.17
type CardMessageElementButtonClick string
CardMessageElementButtonClick is the type for click modes of CardMessageElementButton
const ( CardMessageElementButtonClickLink CardMessageElementButtonClick = "link" CardMessageElementButtonClickReturnVal CardMessageElementButtonClick = "return-val" )
These are predefined usable CardMessageElementButtonClicks
type CardMessageElementImage ¶
type CardMessageElementImage struct { Src string `json:"src"` Alt string `json:"alt,omitempty"` Size string `json:"size,omitempty"` Circle bool `json:"circle"` }
CardMessageElementImage is the type for 元素-图片.
func (CardMessageElementImage) MarshalJSON ¶
func (c CardMessageElementImage) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageElementKMarkdown ¶
type CardMessageElementKMarkdown struct {
Content string `json:"content"`
}
CardMessageElementKMarkdown is the type for 元素-kmarkdown.
func (CardMessageElementKMarkdown) MarshalJSON ¶
func (c CardMessageElementKMarkdown) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageElementText ¶
CardMessageElementText is the type for 元素-普通文本.
func (CardMessageElementText) MarshalJSON ¶
func (c CardMessageElementText) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageFile ¶
type CardMessageFile struct { Type CardMessageFileType `json:"type"` Src string `json:"src"` Title string `json:"title,omitempty"` Cover string `json:"cover,omitempty"` }
CardMessageFile is the type for 模块-文件模块.
type CardMessageFileType ¶ added in v0.0.17
type CardMessageFileType string
CardMessageFileType is the type for types of CardMessageFile
const ( CardMessageFileTypeFile CardMessageFileType = "file" CardMessageFileTypeAudio CardMessageFileType = "audio" CardMessageFileTypeVideo CardMessageFileType = "video" )
These are predefined usable CardMessageFileTypes
type CardMessageHeader ¶
type CardMessageHeader struct {
Text CardMessageElementText `json:"text"`
}
CardMessageHeader is the type for 模块-标题模块.
func (CardMessageHeader) MarshalJSON ¶
func (c CardMessageHeader) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageImageGroup ¶
type CardMessageImageGroup []CardMessageElementImage
CardMessageImageGroup is the type for 图片模块.
func (CardMessageImageGroup) MarshalJSON ¶
func (c CardMessageImageGroup) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageInvite ¶ added in v0.0.17
type CardMessageInvite struct {
Code string `json:"code"`
}
CardMessageInvite is the type for 邀请模块.
func (CardMessageInvite) MarshalJSON ¶ added in v0.0.17
func (c CardMessageInvite) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling.
type CardMessageParagraph ¶
type CardMessageParagraph struct { Cols int `json:"cols"` Fields []interface{} `json:"fields"` }
CardMessageParagraph is the type for 结构体-区域文本.
func (*CardMessageParagraph) AddField ¶
func (c *CardMessageParagraph) AddField(i ...interface{}) *CardMessageParagraph
AddField provides additional type-checking when adding elements to paragraph.
Allowed elements: *CardMessageElementText, *CardMessageElementKMarkdown
func (CardMessageParagraph) MarshalJSON ¶
func (c CardMessageParagraph) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling
type CardMessageSection ¶
type CardMessageSection struct { Mode CardMessageSectionMode `json:"mode,omitempty"` Text interface{} `json:"text"` Accessory interface{} `json:"accessory,omitempty"` }
CardMessageSection is the type for 模块-内容模块.
func (CardMessageSection) MarshalJSON ¶
func (c CardMessageSection) MarshalJSON() ([]byte, error)
MarshalJSON adds additional type field when marshaling.
func (*CardMessageSection) SetAccessory ¶
func (c *CardMessageSection) SetAccessory(i interface{}) *CardMessageSection
SetAccessory provides additional type-checking when setting elements to section accessory.
Allowed elements: *CardMessageElementImage, *CardMessageElementButton.
func (*CardMessageSection) SetText ¶
func (c *CardMessageSection) SetText(i interface{}) *CardMessageSection
SetText provides additional type-checking when setting elements to section text.
Allowed elements: *CardMessageElementText, *CardMessageElementKMarkdown, *CardMessageParagraph.
type CardMessageSectionMode ¶ added in v0.0.17
type CardMessageSectionMode string
CardMessageSectionMode is the type of mode for CardMessageSection
const ( CardMessageSectionModeLeft CardMessageSectionMode = "left" CardMessageSectionModeRight CardMessageSectionMode = "right" )
These are predefined usable CardMessageSectionModes
type Channel ¶
type Channel struct { ID string `json:"id"` Name string `json:"name"` UserID string `json:"user_id"` MasterID string `json:"master_id"` GuildID string `json:"guild_id"` Topic string `json:"topic"` IsCategory IntBool `json:"is_category"` ParentID string `json:"parent_id"` Level int `json:"level"` SlowMode int `json:"slow_mode"` Type ChannelType `json:"type"` LimitAmount int `json:"limit_amount"` PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"` PermissionUsers []UserPermissionOverwrite `json:"permission_users"` PermissionSync IntBool `json:"permission_sync"` ServerURL string `json:"server_url"` }
Channel is the struct for a channel in guild. For different channels, some fields may be empty.
type ChannelAddContext ¶ added in v0.0.4
type ChannelAddContext struct { *EventHandlerCommonContext Extra Channel }
func (*ChannelAddContext) GetCommon ¶ added in v0.0.4
func (ctx *ChannelAddContext) GetCommon() *EventHandlerCommonContext
func (*ChannelAddContext) GetExtra ¶ added in v0.0.4
func (ctx *ChannelAddContext) GetExtra() interface{}
type ChannelAddEventHandler ¶
type ChannelAddEventHandler func(*ChannelAddContext)
func (ChannelAddEventHandler) Handle ¶
func (eh ChannelAddEventHandler) Handle(i EventContext)
func (ChannelAddEventHandler) New ¶
func (eh ChannelAddEventHandler) New() EventContext
func (ChannelAddEventHandler) Type ¶
func (eh ChannelAddEventHandler) Type() string
type ChannelCreate ¶
type ChannelCreate struct { GuildID string `json:"guild_id"` ParentID string `json:"parent_id,omitempty"` Name string `json:"name"` Type ChannelType `json:"type,omitempty"` LimitAmount int `json:"limit_amount,omitempty"` VoiceQuality int `json:"voice_quality,omitempty"` }
ChannelCreate is the arguments for creating a channel.
type ChannelDeleteContext ¶ added in v0.0.4
type ChannelDeleteContext struct { *EventHandlerCommonContext Extra struct { ID string `json:"id"` DeletedAt MilliTimeStamp `json:"deleted_at"` } }
func (*ChannelDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *ChannelDeleteContext) GetCommon() *EventHandlerCommonContext
func (*ChannelDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *ChannelDeleteContext) GetExtra() interface{}
type ChannelDeleteEventHandler ¶ added in v0.0.4
type ChannelDeleteEventHandler func(*ChannelDeleteContext)
func (ChannelDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh ChannelDeleteEventHandler) Handle(i EventContext)
func (ChannelDeleteEventHandler) New ¶ added in v0.0.4
func (eh ChannelDeleteEventHandler) New() EventContext
func (ChannelDeleteEventHandler) Type ¶ added in v0.0.4
func (eh ChannelDeleteEventHandler) Type() string
type ChannelMessage ¶
type ChannelMessage struct { MsgID string `json:"msg_id"` Content string `json:"content"` ContentID string `json:"content_id"` Mention []string `json:"mention"` MentionAll bool `json:"mention_all"` MentionHere bool `json:"mention_here"` MentionRole []string `json:"mention_role"` UpdatedAt int64 `json:"updated_at"` }
ChannelMessage is the struct for a message in a channel.
type ChannelRoleBase ¶
type ChannelRoleBase struct { ChannelID string `json:"channel_id"` Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` }
ChannelRoleBase is the common arguments for channel role requests.
type ChannelRoleCreate ¶
type ChannelRoleCreate ChannelRoleBase
ChannelRoleCreate is the request query data for ChannelRoleCreate.
type ChannelRoleCreateResp ¶ added in v0.0.17
type ChannelRoleCreateResp ChannelRoleUpdateResp
ChannelRoleCreateResp is the response for ChannelRoleCreate.
type ChannelRoleDelete ¶
type ChannelRoleDelete ChannelRoleBase
ChannelRoleDelete is the type for settings when deleting a role from channel setting.
type ChannelRoleIndex ¶
type ChannelRoleIndex struct { PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"` PermissionUsers []struct { User User `json:"user"` Allow RolePermission `json:"allow"` Deny RolePermission `json:"deny"` } `json:"permission_users"` PermissionSync IntBool `json:"permission_sync"` }
ChannelRoleIndex is the role and permission list of a channel.
type ChannelRoleUpdate ¶
type ChannelRoleUpdate struct { ChannelRoleBase Allow RolePermission `json:"allow,omitempty"` Deny RolePermission `json:"deny,omitempty"` }
ChannelRoleUpdate is the request query data for ChannelRoleUpdate
type ChannelRoleUpdateResp ¶
type ChannelRoleUpdateResp struct { UserID string `json:"user_id"` RoleID string `json:"role_id"` Allow RolePermission `json:"allow"` Deny RolePermission `json:"deny"` }
ChannelRoleUpdateResp is the response of ChannelRoleUpdate
type ChannelType ¶
type ChannelType int8
ChannelType is the type of a channel.
const ( ChannelTypeText ChannelType = 1 + iota ChannelTypeVoice )
These are all channel types.
type ChannelUpdateContext ¶ added in v0.0.4
type ChannelUpdateContext struct { *EventHandlerCommonContext Extra Channel }
func (*ChannelUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *ChannelUpdateContext) GetCommon() *EventHandlerCommonContext
func (*ChannelUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *ChannelUpdateContext) GetExtra() interface{}
type ChannelUpdateEventHandler ¶
type ChannelUpdateEventHandler func(*ChannelUpdateContext)
func (ChannelUpdateEventHandler) Handle ¶
func (eh ChannelUpdateEventHandler) Handle(i EventContext)
func (ChannelUpdateEventHandler) New ¶
func (eh ChannelUpdateEventHandler) New() EventContext
func (ChannelUpdateEventHandler) Type ¶
func (eh ChannelUpdateEventHandler) Type() string
type DetailedChannelMessage ¶
type DetailedChannelMessage struct { ID string `json:"id"` Type MessageType `json:"type"` Author User `json:"author"` Content string `json:"content"` Mention []string `json:"mention"` MentionAll bool `json:"mention_all"` MentionHere bool `json:"mention_here"` MentionRole []string `json:"mention_role"` Embeds []map[string]string `json:"embeds"` Attachments *Attachment `json:"attachments"` Reactions []ReactionItem `json:"reactions"` Quote *DetailedChannelMessage `json:"quote"` MentionInfo struct { MentionPart []*User `json:"mention_part"` MentionRolePart []*Role `json:"mention_role_part"` } `json:"mention_info"` }
DetailedChannelMessage is the struct for a detailed message in a channel.
type DirectMessageCreate ¶
type DirectMessageCreate struct { MessageCreateBase ChatCode string `json:"chat_code,omitempty"` }
DirectMessageCreate is the struct for settings of creating a message in direct chat.
type DirectMessageCreateOption ¶ added in v0.0.16
type DirectMessageCreateOption func(*DirectMessageCreate)
DirectMessageCreateOption is the type for decorator of DirectMessageCreate.
func DirectMessageCreateWithCard ¶ added in v0.0.16
func DirectMessageCreateWithCard() DirectMessageCreateOption
DirectMessageCreateWithCard changes message type to card.
func DirectMessageCreateWithKmarkdown ¶ added in v0.0.16
func DirectMessageCreateWithKmarkdown() DirectMessageCreateOption
DirectMessageCreateWithKmarkdown changes message type to Kmarkdown.
type DirectMessageDeleteContext ¶ added in v0.0.4
type DirectMessageDeleteContext struct { *EventHandlerCommonContext Extra struct { MsgID string `json:"msg_id"` AuthorID string `json:"author_id"` TargetID string `json:"target_id"` ChatCode string `json:"chat_code"` DeletedAt MilliTimeStamp `json:"deleted_at"` } }
func (*DirectMessageDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *DirectMessageDeleteContext) GetCommon() *EventHandlerCommonContext
func (*DirectMessageDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *DirectMessageDeleteContext) GetExtra() interface{}
type DirectMessageDeleteEventHandler ¶ added in v0.0.4
type DirectMessageDeleteEventHandler func(*DirectMessageDeleteContext)
func (DirectMessageDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh DirectMessageDeleteEventHandler) Handle(i EventContext)
func (DirectMessageDeleteEventHandler) New ¶ added in v0.0.4
func (eh DirectMessageDeleteEventHandler) New() EventContext
func (DirectMessageDeleteEventHandler) Type ¶ added in v0.0.4
func (eh DirectMessageDeleteEventHandler) Type() string
type DirectMessageListOption ¶
DirectMessageListOption is the type for optional arguments for DirectMessageList request.
func DirectMessageListWithChatCode ¶
func DirectMessageListWithChatCode(chatCode string) DirectMessageListOption
DirectMessageListWithChatCode adds optional `chat_code` argument to DirectMessageList request.
func DirectMessageListWithFlag ¶
func DirectMessageListWithFlag(flag MessageListFlag) DirectMessageListOption
DirectMessageListWithFlag adds optional `flag` argument to DirectMessageList request.
func DirectMessageListWithMsgID ¶
func DirectMessageListWithMsgID(msgID string) DirectMessageListOption
DirectMessageListWithMsgID adds optional `msg_id` argument to DirectMessageList request.
func DirectMessageListWithTargetID ¶
func DirectMessageListWithTargetID(targetID string) DirectMessageListOption
DirectMessageListWithTargetID adds optional `target_id` argument to DirectMessageList request.
type DirectMessageReactionAddContext ¶ added in v0.0.4
type DirectMessageReactionAddContext struct { *EventHandlerCommonContext Extra EventDirectChatReactionItem }
func (*DirectMessageReactionAddContext) GetCommon ¶ added in v0.0.4
func (ctx *DirectMessageReactionAddContext) GetCommon() *EventHandlerCommonContext
func (*DirectMessageReactionAddContext) GetExtra ¶ added in v0.0.4
func (ctx *DirectMessageReactionAddContext) GetExtra() interface{}
type DirectMessageReactionAddEventHandler ¶ added in v0.0.4
type DirectMessageReactionAddEventHandler func(*DirectMessageReactionAddContext)
func (DirectMessageReactionAddEventHandler) Handle ¶ added in v0.0.4
func (eh DirectMessageReactionAddEventHandler) Handle(i EventContext)
func (DirectMessageReactionAddEventHandler) New ¶ added in v0.0.4
func (eh DirectMessageReactionAddEventHandler) New() EventContext
func (DirectMessageReactionAddEventHandler) Type ¶ added in v0.0.4
func (eh DirectMessageReactionAddEventHandler) Type() string
type DirectMessageReactionDeleteContext ¶ added in v0.0.4
type DirectMessageReactionDeleteContext struct { *EventHandlerCommonContext Extra EventDirectChatReactionItem }
func (*DirectMessageReactionDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *DirectMessageReactionDeleteContext) GetCommon() *EventHandlerCommonContext
func (*DirectMessageReactionDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *DirectMessageReactionDeleteContext) GetExtra() interface{}
type DirectMessageReactionDeleteEventHandler ¶ added in v0.0.4
type DirectMessageReactionDeleteEventHandler func(*DirectMessageReactionDeleteContext)
func (DirectMessageReactionDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh DirectMessageReactionDeleteEventHandler) Handle(i EventContext)
func (DirectMessageReactionDeleteEventHandler) New ¶ added in v0.0.4
func (eh DirectMessageReactionDeleteEventHandler) New() EventContext
func (DirectMessageReactionDeleteEventHandler) Type ¶ added in v0.0.4
func (eh DirectMessageReactionDeleteEventHandler) Type() string
type DirectMessageResp ¶
type DirectMessageResp struct { ID string `json:"id"` Type MessageType `json:"type"` Content string `json:"content"` Embeds []map[string]string `json:"embeds"` Attachments []Attachment `json:"attachments"` CreateAt MilliTimeStamp `json:"create_at"` UpdatedAt MilliTimeStamp `json:"updated_at"` Reactions []ReactionItem `json:"reactions"` ImageName string `json:"image_name"` ReadStatus bool `json:"read_status"` Quote *User `json:"quote"` MentionInfo struct { MentionPart []*User `json:"mention_part"` MentionRolePart []*Role `json:"mention_role_part"` } `json:"mention_info"` }
DirectMessageResp is the type for direct messages.
type DirectMessageUpdate ¶
type DirectMessageUpdate MessageUpdateBase
DirectMessageUpdate is the type for settings of updating a message in direct chat.
type DirectMessageUpdateContext ¶ added in v0.0.4
type DirectMessageUpdateContext struct { *EventHandlerCommonContext Extra struct { MsgID string `json:"msg_id"` AuthorID string `json:"author_id"` TargetID string `json:"target_id"` Content string `json:"content"` ChatCode string `json:"chat_code"` UpdatedAt MilliTimeStamp `json:"updated_at"` } }
func (*DirectMessageUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *DirectMessageUpdateContext) GetCommon() *EventHandlerCommonContext
func (*DirectMessageUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *DirectMessageUpdateContext) GetExtra() interface{}
type DirectMessageUpdateEventHandler ¶ added in v0.0.4
type DirectMessageUpdateEventHandler func(*DirectMessageUpdateContext)
func (DirectMessageUpdateEventHandler) Handle ¶ added in v0.0.4
func (eh DirectMessageUpdateEventHandler) Handle(i EventContext)
func (DirectMessageUpdateEventHandler) New ¶ added in v0.0.4
func (eh DirectMessageUpdateEventHandler) New() EventContext
func (DirectMessageUpdateEventHandler) Type ¶ added in v0.0.4
func (eh DirectMessageUpdateEventHandler) Type() string
type EmojiItem ¶
EmojiItem is the type for an emoji.
type EndpointGeneralResponse ¶
type EndpointGeneralResponse struct { Code int `json:"code"` Message string `json:"message"` Data json.RawMessage `json:"data"` }
EndpointGeneralResponse is the struct for initial parsing REST requests.
type Entry ¶
type Entry interface { Bool(key string, b bool) Entry Bytes(key string, val []byte) Entry Caller(depth int) Entry Dur(key string, d time.Duration) Entry Err(key string, err error) Entry Float64(key string, f float64) Entry IPAddr(key string, ip net.IP) Entry Int(key string, i int) Entry Int64(key string, i int64) Entry Interface(key string, i interface{}) Entry Msg(msg string) Msgf(f string, i ...interface{}) Str(key string, s string) Entry Strs(key string, s []string) Entry Time(key string, t time.Time) Entry }
Entry is the interface which external loggers' entry should meet.
type Event ¶
type Event struct { Signal EventSignal `json:"s"` Data json.RawMessage `json:"d"` SequenceNumber int64 `json:"sn"` }
Event is the struct for every received event.
type EventCardMessageContext ¶ added in v0.0.4
type EventCardMessageContext struct { *EventHandlerCommonContext Extra EventCustomMessage }
func (*EventCardMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *EventCardMessageContext) GetCommon() *EventHandlerCommonContext
func (*EventCardMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *EventCardMessageContext) GetExtra() interface{}
type EventCardMessageEventHandler ¶
type EventCardMessageEventHandler func(*EventCardMessageContext)
func (EventCardMessageEventHandler) Handle ¶
func (eh EventCardMessageEventHandler) Handle(i EventContext)
func (EventCardMessageEventHandler) New ¶
func (eh EventCardMessageEventHandler) New() EventContext
func (EventCardMessageEventHandler) Type ¶
func (eh EventCardMessageEventHandler) Type() string
type EventContext ¶ added in v0.0.4
type EventContext interface { GetExtra() interface{} GetCommon() *EventHandlerCommonContext }
EventContext is the interface for objects containing context for event handlers.
type EventCustomMessage ¶ added in v0.0.4
type EventCustomMessage struct { MentionAll bool `json:"mention_all"` MentionRoles []int64 `json:"mention_roles"` MentionHere bool `json:"mention_here"` Author User `json:"author"` Kmarkdown EventKmarkdown `json:"kmarkdown"` GuildID string `json:"guild_id"` ChannelName string `json:"channel_name"` Mention []string `json:"mention"` }
func (*EventCustomMessage) UnmarshalJSON ¶ added in v0.0.25
func (m *EventCustomMessage) UnmarshalJSON(bytes []byte) error
UnmarshalJSON deals with untyped mention in custom message in event.
type EventData ¶
type EventData struct { *EventDataGeneral Extra json.RawMessage `json:"extra"` }
EventData is the struct for initial parsing event's data payload.
type EventDataGeneral ¶
type EventDataGeneral struct { ChannelType string `json:"channel_type"` Type MessageType `json:"type"` TargetID string `json:"target_id"` AuthorID string `json:"author_id"` Content string `json:"content"` MsgID string `json:"msg_id"` MsgTimestamp int64 `json:"msg_timestamp"` Nonce string `json:"nonce"` }
EventDataGeneral is the struct passed to all event handler.
type EventDataHello ¶
type EventDataHello struct { Code EventStatusCode `json:"code"` SessionID string `json:"session_id"` }
EventDataHello is the struct for the data of event hello
type EventDataResumeAck ¶
type EventDataResumeAck struct {
SessionID string `json:"session_id"`
}
EventDataResumeAck is the struct for the data of event resume ack.
type EventDataSystem ¶
type EventDataSystem struct { Type string `json:"type"` Body json.RawMessage `json:"body"` }
EventDataSystem is the struct for initial parsing system events. TODO: Implement a marshaller.
type EventDirectChatReactionItem ¶ added in v0.0.4
type EventGuild ¶ added in v0.0.4
type EventGuild struct { ID string `json:"id"` UserID string `json:"user_id"` NotifyType GuildNotifyType `json:"notify_type"` WelcomeChannelID string `json:"welcome_channel_id"` OpenID int64 `json:"open_id"` DefaultChannelID string `json:"default_channel_id"` Name string `json:"name"` Icon string `json:"icon"` Region string `json:"region"` EnableOpen IntBool `json:"enable_open"` }
type EventGuildMemberOnlineItem ¶ added in v0.0.4
type EventGuildMemberOnlineItem struct { UserId string `json:"user_id"` EventTime MilliTimeStamp `json:"event_time"` Guilds []string `json:"guilds"` }
type EventHandler ¶
type EventHandler interface { Type() string Handle(EventContext) }
EventHandler is the interface for objects handling event.
type EventHandlerCommonContext ¶ added in v0.0.4
type EventHandlerCommonContext struct { Session *Session Common *EventDataGeneral }
EventHandlerCommonContext is the common context for event handlers.
type EventHandlerProvider ¶
type EventHandlerProvider interface { Type() string New() EventContext }
EventHandlerProvider is the interface for objects providing event handlers.
type EventKmarkdown ¶ added in v0.0.4
type EventKmarkdown struct { RawContent string `json:"raw_content"` MentionPart []EventMentionPart `json:"mention_part"` MentionRolePart []EventMentionRolePart `json:"mention_role_part"` }
type EventMentionPart ¶ added in v0.0.13
type EventMentionRolePart ¶ added in v0.0.13
type EventPinMessageItem ¶ added in v0.0.4
type EventReactionItem ¶ added in v0.0.4
type EventRichMessage ¶ added in v0.0.4
type EventRichMessage struct { GuildID string `json:"guild_id"` Attachments Attachment `json:"attachments"` Author User `json:"author"` }
type EventSignal ¶
type EventSignal int8
EventSignal is the type for event types.
const ( EventSignalEvent EventSignal = iota EventSignalHello EventSignalPing EventSignalPong EventSignalReconnect EventSignal = iota + 1 EventSignalResumeAck )
All event signal consts.
type EventStatusCode ¶
type EventStatusCode int
EventStatusCode is the type for various event status code.
const ( EventStatusOk EventStatusCode = 0 EventStatusMissingArgument EventStatusCode = 40100 + iota EventStatusInvalidToken EventStatusTokenAuthFailed EventStatusTokenExpired EventStatusResumeFailed EventStatusCode = 40100 + 2 + iota EventStatusSessionExpired EventStatusInvalidSequenceNumber )
EventStatusCode consts for event status
type FileMessageContext ¶ added in v0.0.4
type FileMessageContext struct { *EventHandlerCommonContext Extra EventRichMessage }
func (*FileMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *FileMessageContext) GetCommon() *EventHandlerCommonContext
func (*FileMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *FileMessageContext) GetExtra() interface{}
type FileMessageEventHandler ¶ added in v0.0.4
type FileMessageEventHandler func(*FileMessageContext)
func (FileMessageEventHandler) Handle ¶ added in v0.0.4
func (eh FileMessageEventHandler) Handle(i EventContext)
func (FileMessageEventHandler) New ¶ added in v0.0.4
func (eh FileMessageEventHandler) New() EventContext
func (FileMessageEventHandler) Type ¶ added in v0.0.4
func (eh FileMessageEventHandler) Type() string
type Game ¶ added in v0.0.20
type Game struct { ID int64 `json:"id"` Name string `json:"name"` Type GameType `json:"type"` Options string `json:"options"` KmhookAdmin bool `json:"kmhook_admin"` ProcessName []string `json:"process_name"` ProductName []string `json:"product_name"` Icon string `json:"icon"` }
Game is a game item registered at khl.
type GameCreate ¶ added in v0.0.20
type GameCreate struct { Name string `json:"name"` ProcessName string `json:"process_name,omitempty"` Icon string `json:"icon,omitempty"` }
GameCreate is the type for arguments of GameCreate request.
type GameUpdate ¶ added in v0.0.20
type GameUpdate struct { ID int64 `json:"id"` Name string `json:"name,omitempty"` Icon string `json:"icon,omitempty"` }
GameUpdate is the type for arguments of GameUpdate request.
type GeneralListData ¶
type GeneralListData struct { Items json.RawMessage `json:"items"` Meta PageInfo `json:"meta"` Sort map[string]int `json:"sort"` }
GeneralListData is the struct for list GET responses.
type Guild ¶
type Guild struct { ID string `json:"id"` Name string `json:"name"` Topic string `json:"topic"` MasterID string `json:"master_id"` // For compatibility reason UserID string `json:"user_id"` Icon string `json:"icon"` NotifyType GuildNotifyType `json:"notify_type"` Region string `json:"region"` EnableOpen IntBool `json:"enable_open"` OpenID string `json:"open_id"` DefaultChannelID string `json:"default_channel_id"` WelcomeChannelID string `json:"welcome_channel_id"` Roles []Role `json:"roles"` Channels []Channel `json:"channels"` }
Guild is the struct for a server/guild(服务器).
func (Guild) GetMasterID ¶
GetMasterID returns the master id of the guild, not sure if it is necessary as may doc is wrong.
type GuildChannelMemberAddContext ¶ added in v0.0.4
type GuildChannelMemberAddContext struct { *EventHandlerCommonContext Extra struct { UserID string `json:"user_id"` ChannelID string `json:"channel_id"` JoinedAt MilliTimeStamp `json:"joined_at"` } }
func (*GuildChannelMemberAddContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildChannelMemberAddContext) GetCommon() *EventHandlerCommonContext
func (*GuildChannelMemberAddContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildChannelMemberAddContext) GetExtra() interface{}
type GuildChannelMemberAddEventHandler ¶ added in v0.0.4
type GuildChannelMemberAddEventHandler func(*GuildChannelMemberAddContext)
func (GuildChannelMemberAddEventHandler) Handle ¶ added in v0.0.4
func (eh GuildChannelMemberAddEventHandler) Handle(i EventContext)
func (GuildChannelMemberAddEventHandler) New ¶ added in v0.0.4
func (eh GuildChannelMemberAddEventHandler) New() EventContext
func (GuildChannelMemberAddEventHandler) Type ¶ added in v0.0.4
func (eh GuildChannelMemberAddEventHandler) Type() string
type GuildChannelMemberDeleteContext ¶ added in v0.0.4
type GuildChannelMemberDeleteContext struct { *EventHandlerCommonContext Extra struct { UserID string `json:"user_id"` ChannelID string `json:"channel_id"` ExitedAt MilliTimeStamp `json:"exited_at"` } }
func (*GuildChannelMemberDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildChannelMemberDeleteContext) GetCommon() *EventHandlerCommonContext
func (*GuildChannelMemberDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildChannelMemberDeleteContext) GetExtra() interface{}
type GuildChannelMemberDeleteEventHandler ¶ added in v0.0.4
type GuildChannelMemberDeleteEventHandler func(*GuildChannelMemberDeleteContext)
func (GuildChannelMemberDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh GuildChannelMemberDeleteEventHandler) Handle(i EventContext)
func (GuildChannelMemberDeleteEventHandler) New ¶ added in v0.0.4
func (eh GuildChannelMemberDeleteEventHandler) New() EventContext
func (GuildChannelMemberDeleteEventHandler) Type ¶ added in v0.0.4
func (eh GuildChannelMemberDeleteEventHandler) Type() string
type GuildDeleteContext ¶ added in v0.0.4
type GuildDeleteContext struct { *EventHandlerCommonContext Extra EventGuild }
func (*GuildDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildDeleteContext) GetCommon() *EventHandlerCommonContext
func (*GuildDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildDeleteContext) GetExtra() interface{}
type GuildDeleteEventHandler ¶
type GuildDeleteEventHandler func(*GuildDeleteContext)
func (GuildDeleteEventHandler) Handle ¶
func (eh GuildDeleteEventHandler) Handle(i EventContext)
func (GuildDeleteEventHandler) New ¶
func (eh GuildDeleteEventHandler) New() EventContext
func (GuildDeleteEventHandler) Type ¶
func (eh GuildDeleteEventHandler) Type() string
type GuildEmojiResp ¶
type GuildEmojiResp struct { Name string `json:"name"` ID string `json:"id"` UserInfo User `json:"user_info"` }
GuildEmojiResp is the type for response of GuildEmojiList request.
type GuildMemberAddContext ¶ added in v0.0.4
type GuildMemberAddContext struct { *EventHandlerCommonContext Extra struct { UserID string `json:"user_id"` JoinedAt MilliTimeStamp `json:"joined_at"` } }
func (*GuildMemberAddContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildMemberAddContext) GetCommon() *EventHandlerCommonContext
func (*GuildMemberAddContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildMemberAddContext) GetExtra() interface{}
type GuildMemberAddEventHandler ¶
type GuildMemberAddEventHandler func(*GuildMemberAddContext)
func (GuildMemberAddEventHandler) Handle ¶
func (eh GuildMemberAddEventHandler) Handle(i EventContext)
func (GuildMemberAddEventHandler) New ¶
func (eh GuildMemberAddEventHandler) New() EventContext
func (GuildMemberAddEventHandler) Type ¶
func (eh GuildMemberAddEventHandler) Type() string
type GuildMemberDeleteContext ¶ added in v0.0.4
type GuildMemberDeleteContext struct { *EventHandlerCommonContext Extra struct { UserID string `json:"user_id"` ExitedAt MilliTimeStamp `json:"exited_at"` } }
func (*GuildMemberDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildMemberDeleteContext) GetCommon() *EventHandlerCommonContext
func (*GuildMemberDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildMemberDeleteContext) GetExtra() interface{}
type GuildMemberDeleteEventHandler ¶ added in v0.0.4
type GuildMemberDeleteEventHandler func(*GuildMemberDeleteContext)
func (GuildMemberDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh GuildMemberDeleteEventHandler) Handle(i EventContext)
func (GuildMemberDeleteEventHandler) New ¶ added in v0.0.4
func (eh GuildMemberDeleteEventHandler) New() EventContext
func (GuildMemberDeleteEventHandler) Type ¶ added in v0.0.4
func (eh GuildMemberDeleteEventHandler) Type() string
type GuildMemberOfflineContext ¶ added in v0.0.4
type GuildMemberOfflineContext struct { *EventHandlerCommonContext Extra EventGuildMemberOnlineItem }
func (*GuildMemberOfflineContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildMemberOfflineContext) GetCommon() *EventHandlerCommonContext
func (*GuildMemberOfflineContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildMemberOfflineContext) GetExtra() interface{}
type GuildMemberOfflineEventHandler ¶
type GuildMemberOfflineEventHandler func(*GuildMemberOfflineContext)
func (GuildMemberOfflineEventHandler) Handle ¶
func (eh GuildMemberOfflineEventHandler) Handle(i EventContext)
func (GuildMemberOfflineEventHandler) New ¶
func (eh GuildMemberOfflineEventHandler) New() EventContext
func (GuildMemberOfflineEventHandler) Type ¶
func (eh GuildMemberOfflineEventHandler) Type() string
type GuildMemberOnlineContext ¶ added in v0.0.4
type GuildMemberOnlineContext struct { *EventHandlerCommonContext Extra EventGuildMemberOnlineItem }
func (*GuildMemberOnlineContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildMemberOnlineContext) GetCommon() *EventHandlerCommonContext
func (*GuildMemberOnlineContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildMemberOnlineContext) GetExtra() interface{}
type GuildMemberOnlineEventHandler ¶
type GuildMemberOnlineEventHandler func(*GuildMemberOnlineContext)
func (GuildMemberOnlineEventHandler) Handle ¶
func (eh GuildMemberOnlineEventHandler) Handle(i EventContext)
func (GuildMemberOnlineEventHandler) New ¶
func (eh GuildMemberOnlineEventHandler) New() EventContext
func (GuildMemberOnlineEventHandler) Type ¶
func (eh GuildMemberOnlineEventHandler) Type() string
type GuildMemberUpdateContext ¶ added in v0.0.4
type GuildMemberUpdateContext struct { *EventHandlerCommonContext Extra struct { UserID string `json:"user_id"` Nickname string `json:"nickname"` } }
func (*GuildMemberUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildMemberUpdateContext) GetCommon() *EventHandlerCommonContext
func (*GuildMemberUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildMemberUpdateContext) GetExtra() interface{}
type GuildMemberUpdateEventHandler ¶
type GuildMemberUpdateEventHandler func(*GuildMemberUpdateContext)
func (GuildMemberUpdateEventHandler) Handle ¶
func (eh GuildMemberUpdateEventHandler) Handle(i EventContext)
func (GuildMemberUpdateEventHandler) New ¶
func (eh GuildMemberUpdateEventHandler) New() EventContext
func (GuildMemberUpdateEventHandler) Type ¶
func (eh GuildMemberUpdateEventHandler) Type() string
type GuildMuteList ¶
GuildMuteList is the type for users that got muted in a guild.
type GuildMuteSetting ¶
type GuildMuteSetting struct { GuildID string `json:"guild_id"` UserID string `json:"user_id"` Type MuteType `json:"type"` }
GuildMuteSetting is the type for arguments of GuildMuteSetting.
type GuildNickname ¶
type GuildNickname struct { GuildID string `json:"guild_id"` Nickname string `json:"nickname,omitempty"` UserID string `json:"user_id,omitempty"` }
GuildNickname is the arguments for GuildNickname.
type GuildNotifyType ¶
type GuildNotifyType int8
GuildNotifyType is the type of the notify type of a guild.
const ( GuildNotifyTypeDefault GuildNotifyType = iota GuildNotifyTypeAll GuildNotifyTypeMention GuildNotifyTypeDisable )
These are all notify types.
type GuildRoleAddContext ¶ added in v0.0.4
type GuildRoleAddContext struct { *EventHandlerCommonContext Extra Role }
func (*GuildRoleAddContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildRoleAddContext) GetCommon() *EventHandlerCommonContext
func (*GuildRoleAddContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildRoleAddContext) GetExtra() interface{}
type GuildRoleAddEventHandler ¶
type GuildRoleAddEventHandler func(*GuildRoleAddContext)
func (GuildRoleAddEventHandler) Handle ¶
func (eh GuildRoleAddEventHandler) Handle(i EventContext)
func (GuildRoleAddEventHandler) New ¶
func (eh GuildRoleAddEventHandler) New() EventContext
func (GuildRoleAddEventHandler) Type ¶
func (eh GuildRoleAddEventHandler) Type() string
type GuildRoleDeleteContext ¶ added in v0.0.4
type GuildRoleDeleteContext struct { *EventHandlerCommonContext Extra Role }
func (*GuildRoleDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildRoleDeleteContext) GetCommon() *EventHandlerCommonContext
func (*GuildRoleDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildRoleDeleteContext) GetExtra() interface{}
type GuildRoleDeleteEventHandler ¶ added in v0.0.4
type GuildRoleDeleteEventHandler func(*GuildRoleDeleteContext)
func (GuildRoleDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh GuildRoleDeleteEventHandler) Handle(i EventContext)
func (GuildRoleDeleteEventHandler) New ¶ added in v0.0.4
func (eh GuildRoleDeleteEventHandler) New() EventContext
func (GuildRoleDeleteEventHandler) Type ¶ added in v0.0.4
func (eh GuildRoleDeleteEventHandler) Type() string
type GuildRoleResp ¶
type GuildRoleResp struct { GuildID string `json:"guild_id"` UserID string `json:"user_id"` Roles []int64 `json:"roles"` }
GuildRoleResp is the response of GuildRoleGrant request.
type GuildRoleUpdateContext ¶ added in v0.0.4
type GuildRoleUpdateContext struct { *EventHandlerCommonContext Extra Role }
func (*GuildRoleUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildRoleUpdateContext) GetCommon() *EventHandlerCommonContext
func (*GuildRoleUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildRoleUpdateContext) GetExtra() interface{}
type GuildRoleUpdateEventHandler ¶
type GuildRoleUpdateEventHandler func(*GuildRoleUpdateContext)
func (GuildRoleUpdateEventHandler) Handle ¶
func (eh GuildRoleUpdateEventHandler) Handle(i EventContext)
func (GuildRoleUpdateEventHandler) New ¶
func (eh GuildRoleUpdateEventHandler) New() EventContext
func (GuildRoleUpdateEventHandler) Type ¶
func (eh GuildRoleUpdateEventHandler) Type() string
type GuildUpdateContext ¶ added in v0.0.4
type GuildUpdateContext struct { *EventHandlerCommonContext Extra EventGuild }
func (*GuildUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *GuildUpdateContext) GetCommon() *EventHandlerCommonContext
func (*GuildUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *GuildUpdateContext) GetExtra() interface{}
type GuildUpdateEventHandler ¶
type GuildUpdateEventHandler func(*GuildUpdateContext)
func (GuildUpdateEventHandler) Handle ¶
func (eh GuildUpdateEventHandler) Handle(i EventContext)
func (GuildUpdateEventHandler) New ¶
func (eh GuildUpdateEventHandler) New() EventContext
func (GuildUpdateEventHandler) Type ¶
func (eh GuildUpdateEventHandler) Type() string
type GuildUserListInfo ¶ added in v0.0.27
type GuildUserListOption ¶
GuildUserListOption is the type for optional arguments for GuildUserList request.
func GuildUserListWithActiveTime ¶
func GuildUserListWithActiveTime(activeTime bool) GuildUserListOption
GuildUserListWithActiveTime adds optional `active_time` argument to GuildUserList request.
func GuildUserListWithChannelID ¶
func GuildUserListWithChannelID(id string) GuildUserListOption
GuildUserListWithChannelID adds optional `channel_id` argument to GuildUserList request.
func GuildUserListWithJoinedAt ¶
func GuildUserListWithJoinedAt(joinedAt bool) GuildUserListOption
GuildUserListWithJoinedAt adds optional `joined_at` argument to GuildUserList request.
func GuildUserListWithMobileVerified ¶
func GuildUserListWithMobileVerified(verified bool) GuildUserListOption
GuildUserListWithMobileVerified adds optional `mobile_verified` argument to GuildUserList request.
func GuildUserListWithRoleID ¶
func GuildUserListWithRoleID(roleID int64) GuildUserListOption
GuildUserListWithRoleID adds optional `role_id` argument to GuildUserList request.
func GuildUserListWithSearch ¶
func GuildUserListWithSearch(search string) GuildUserListOption
GuildUserListWithSearch adds optional `search` argument to GuildUserList request.
type Identify ¶
type Identify struct { Token string Compress bool WebsocketKey []byte ClientID string ClientSecret string VerifyToken string }
Identify is the struct for the initial settings sent to kaiheila.
type ImageMessageContext ¶ added in v0.0.4
type ImageMessageContext struct { *EventHandlerCommonContext Extra EventRichMessage }
func (*ImageMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *ImageMessageContext) GetCommon() *EventHandlerCommonContext
func (*ImageMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *ImageMessageContext) GetExtra() interface{}
type ImageMessageEventHandler ¶ added in v0.0.4
type ImageMessageEventHandler func(*ImageMessageContext)
func (ImageMessageEventHandler) Handle ¶ added in v0.0.4
func (eh ImageMessageEventHandler) Handle(i EventContext)
func (ImageMessageEventHandler) New ¶ added in v0.0.4
func (eh ImageMessageEventHandler) New() EventContext
func (ImageMessageEventHandler) Type ¶ added in v0.0.4
func (eh ImageMessageEventHandler) Type() string
type IntBool ¶ added in v0.0.2
type IntBool bool
IntBool is the type for some int value in response which only has two valid values.
func (*IntBool) MarshalJSON ¶ added in v0.0.2
MarshalJSON is used to marshal IntBool for reqeust.
func (*IntBool) UnmarshalJSON ¶ added in v0.0.2
UnmarshalJSON is used to unmarshal IntBool from response.
type IntimacyIndexResp ¶
type IntimacyIndexResp struct { ImgURL string `json:"img_url"` SocialInfo string `json:"social_info"` LastRead MilliTimeStamp `json:"last_read"` ImgList struct { ID string `json:"id"` URL string `json:"url"` } `json:"img_list"` }
IntimacyIndexResp is the type for intimacy info.
type IntimacyUpdate ¶
type IntimacyUpdate struct { UserID string `json:"user_id"` Score *int `json:"score,omitempty"` SocialInfo string `json:"social_info,omitempty"` ImgID int `json:"img_id,omitempty"` }
IntimacyUpdate is the type for arguments for IntimacyUpdate request.
type InviteCreate ¶
type InviteCreate struct { GuildID string `json:"guild_id,omitempty"` ChannelID string `json:"channel_id,omitempty"` Duration InviteDuration `json:"duration,omitempty"` SettingTimes InviteSettingTimes `json:"setting_times,omitempty"` }
InviteCreate is the type for arguments of InviteCreate request.
type InviteDelete ¶
type InviteDelete struct { GuildID string `json:"guild_id,omitempty"` ChannelID string `json:"channel_id,omitempty"` URLCode string `json:"url_code"` }
InviteDelete is the type for arguments of InviteDelete request.
type InviteDuration ¶ added in v0.0.17
type InviteDuration string
InviteDuration is the type for Duration in InviteCreate
You MUST use the enum defined below.
const ( InviteDurationInfinity InviteDuration = "0" InviteDurationHalfHour InviteDuration = "1800" InviteDurationHour InviteDuration = "3600" InviteDurationSixHour InviteDuration = "21600" InviteDurationTwelveHour InviteDuration = "43200" InviteDurationDay InviteDuration = "86400" InviteDurationWeek InviteDuration = "604800" )
These are allowed InviteDuration enums. You MUST use them.
type InviteListOption ¶
InviteListOption is the optional arguments for InviteList requests.
func InviteListWithChannelID ¶
func InviteListWithChannelID(channelID string) InviteListOption
InviteListWithChannelID adds optional `channel_id` argument to InviteList request.
func InviteListWithGuildID ¶
func InviteListWithGuildID(guildID string) InviteListOption
InviteListWithGuildID adds optional `guild_id` argument to InviteList request.
type InviteListResp ¶
type InviteListResp struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` URLCode string `json:"url_code"` URL string `json:"url"` User User `json:"user"` }
InviteListResp is the type for response of InviteList request.
type InviteSettingTimes ¶ added in v0.0.17
type InviteSettingTimes int
InviteSettingTimes is the type for SettingTimes in InviteCreate
You SHOULD use the enum defined below.
const ( InviteSettingTimesInfinity InviteSettingTimes = -1 InviteSettingTimesOne InviteSettingTimes = 1 InviteSettingTimesFive InviteSettingTimes = 5 InviteSettingTimesTen InviteSettingTimes = 10 InviteSettingTimesTwentyFive InviteSettingTimes = 25 InviteSettingTimesFifty InviteSettingTimes = 50 InviteSettingTimesHundred InviteSettingTimes = 100 )
These are allowed InviteSettingTimes enums. You SHOULD use them.
type KmarkdownMessageContext ¶ added in v0.0.4
type KmarkdownMessageContext struct { *EventHandlerCommonContext Extra EventCustomMessage }
func (*KmarkdownMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *KmarkdownMessageContext) GetCommon() *EventHandlerCommonContext
func (*KmarkdownMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *KmarkdownMessageContext) GetExtra() interface{}
type KmarkdownMessageEventHandler ¶ added in v0.0.4
type KmarkdownMessageEventHandler func(*KmarkdownMessageContext)
func (KmarkdownMessageEventHandler) Handle ¶ added in v0.0.4
func (eh KmarkdownMessageEventHandler) Handle(i EventContext)
func (KmarkdownMessageEventHandler) New ¶ added in v0.0.4
func (eh KmarkdownMessageEventHandler) New() EventContext
func (KmarkdownMessageEventHandler) Type ¶ added in v0.0.4
func (eh KmarkdownMessageEventHandler) Type() string
type Logger ¶
type Logger interface { Trace() Entry Debug() Entry Info() Entry Warn() Entry Error() Entry Fatal() Entry }
Logger is the interface which external loggers should meet.
type MessageButtonClickContext ¶ added in v0.0.4
type MessageButtonClickContext struct { *EventHandlerCommonContext Extra struct { MsgID string `json:"msg_id"` UserID string `json:"user_id"` Value string `json:"value"` TargetID string `json:"target_id"` GuildID string `json:"guild_id"` UserInfo User `json:"user_info"` } }
func (*MessageButtonClickContext) GetCommon ¶ added in v0.0.4
func (ctx *MessageButtonClickContext) GetCommon() *EventHandlerCommonContext
func (*MessageButtonClickContext) GetExtra ¶ added in v0.0.4
func (ctx *MessageButtonClickContext) GetExtra() interface{}
type MessageButtonClickEventHandler ¶ added in v0.0.4
type MessageButtonClickEventHandler func(*MessageButtonClickContext)
func (MessageButtonClickEventHandler) Handle ¶ added in v0.0.4
func (eh MessageButtonClickEventHandler) Handle(i EventContext)
func (MessageButtonClickEventHandler) New ¶ added in v0.0.4
func (eh MessageButtonClickEventHandler) New() EventContext
func (MessageButtonClickEventHandler) Type ¶ added in v0.0.4
func (eh MessageButtonClickEventHandler) Type() string
type MessageCreate ¶
type MessageCreate struct { MessageCreateBase TempTargetID string `json:"temp_target_id,omitempty"` }
MessageCreate is the type for message creation arguments.
type MessageCreateBase ¶
type MessageCreateBase struct { Type MessageType `json:"type,omitempty"` TargetID string `json:"target_id,omitempty"` Content string `json:"content,omitempty"` Quote string `json:"quote,omitempty"` Nonce string `json:"nonce,omitempty"` }
MessageCreateBase is the common arguments for message creation.
type MessageCreateOption ¶ added in v0.0.16
type MessageCreateOption func(*MessageCreate)
MessageCreateOption is the type for decorator of MessageCreate.
func MessageCreateWithCard ¶ added in v0.0.16
func MessageCreateWithCard() MessageCreateOption
MessageCreateWithCard changes message type to card.
func MessageCreateWithKmarkdown ¶ added in v0.0.16
func MessageCreateWithKmarkdown() MessageCreateOption
MessageCreateWithKmarkdown changes message type to Kmarkdown.
type MessageDeleteContext ¶ added in v0.0.4
type MessageDeleteContext struct { *EventHandlerCommonContext Extra struct { MsgID string `json:"msg_id"` ChannelID string `json:"channel_id"` } }
func (*MessageDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *MessageDeleteContext) GetCommon() *EventHandlerCommonContext
func (*MessageDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *MessageDeleteContext) GetExtra() interface{}
type MessageDeleteEventHandler ¶ added in v0.0.4
type MessageDeleteEventHandler func(*MessageDeleteContext)
func (MessageDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh MessageDeleteEventHandler) Handle(i EventContext)
func (MessageDeleteEventHandler) New ¶ added in v0.0.4
func (eh MessageDeleteEventHandler) New() EventContext
func (MessageDeleteEventHandler) Type ¶ added in v0.0.4
func (eh MessageDeleteEventHandler) Type() string
type MessageListFlag ¶
type MessageListFlag string
MessageListFlag is the type for the flag of MessageList.
const ( MessageListFlagBefore MessageListFlag = "before" MessageListFlagAround MessageListFlag = "around" MessageListFlagAfter MessageListFlag = "after" )
These are the usable flags
type MessageListOption ¶
MessageListOption is the type for optional arguments for MessageList request.
func MessageListWithFlag ¶
func MessageListWithFlag(flag MessageListFlag) MessageListOption
MessageListWithFlag adds optional `flag` argument to MessageList request.
func MessageListWithMsgID ¶
func MessageListWithMsgID(msgID string) MessageListOption
MessageListWithMsgID adds optional `msg_id` argument to MessageList request.
func MessageListWithPin ¶
func MessageListWithPin(pin bool) MessageListOption
MessageListWithPin adds optional `pin` argument to MessageList request.
type MessagePinContext ¶ added in v0.0.4
type MessagePinContext struct { *EventHandlerCommonContext Extra EventPinMessageItem }
func (*MessagePinContext) GetCommon ¶ added in v0.0.4
func (ctx *MessagePinContext) GetCommon() *EventHandlerCommonContext
func (*MessagePinContext) GetExtra ¶ added in v0.0.4
func (ctx *MessagePinContext) GetExtra() interface{}
type MessagePinEventHandler ¶ added in v0.0.4
type MessagePinEventHandler func(*MessagePinContext)
func (MessagePinEventHandler) Handle ¶ added in v0.0.4
func (eh MessagePinEventHandler) Handle(i EventContext)
func (MessagePinEventHandler) New ¶ added in v0.0.4
func (eh MessagePinEventHandler) New() EventContext
func (MessagePinEventHandler) Type ¶ added in v0.0.4
func (eh MessagePinEventHandler) Type() string
type MessageReaction ¶
type MessageReaction struct { MsgID string `json:"msg_id"` UserID string `json:"user_id"` ChannelID string `json:"channel_id"` ChatCode string `json:"chat_code"` Emoji EmojiItem `json:"emoji"` }
MessageReaction is the struct for reactions embedded to a message.
type MessageResp ¶
type MessageResp struct { MsgID string `json:"msg_id"` MsgTimestamp MilliTimeStamp `json:"msg_timestamp"` Nonce string `json:"nonce"` }
MessageResp is the type for response for MessageCreate.
type MessageType ¶
type MessageType uint8
MessageType is the type for messages from events.
const ( MessageTypeText MessageType = 1 + iota MessageTypeImage MessageTypeVideo MessageTypeFile MessageTypeAudio MessageType = 4 + iota MessageTypeKMarkdown MessageTypeCard MessageTypeSystem MessageType = 255 )
MessageType consts for event message type
type MessageUnpinContext ¶ added in v0.0.4
type MessageUnpinContext struct { *EventHandlerCommonContext Extra EventPinMessageItem }
func (*MessageUnpinContext) GetCommon ¶ added in v0.0.4
func (ctx *MessageUnpinContext) GetCommon() *EventHandlerCommonContext
func (*MessageUnpinContext) GetExtra ¶ added in v0.0.4
func (ctx *MessageUnpinContext) GetExtra() interface{}
type MessageUnpinEventHandler ¶ added in v0.0.4
type MessageUnpinEventHandler func(*MessageUnpinContext)
func (MessageUnpinEventHandler) Handle ¶ added in v0.0.4
func (eh MessageUnpinEventHandler) Handle(i EventContext)
func (MessageUnpinEventHandler) New ¶ added in v0.0.4
func (eh MessageUnpinEventHandler) New() EventContext
func (MessageUnpinEventHandler) Type ¶ added in v0.0.4
func (eh MessageUnpinEventHandler) Type() string
type MessageUpdate ¶
type MessageUpdate struct { MessageUpdateBase TempTargetID string `json:"temp_target_id,omitempty"` }
MessageUpdate is the request data for MessageUpdate.
type MessageUpdateBase ¶
type MessageUpdateBase struct { MsgID string `json:"msg_id"` Content string `json:"content"` Quote string `json:"quote,omitempty"` }
MessageUpdateBase is the shared arguments for message update related requests.
type MessageUpdateContext ¶ added in v0.0.4
type MessageUpdateContext struct { *EventHandlerCommonContext Extra struct { Content string `json:"content"` ChannelID string `json:"channel_id"` Mention []string `json:"mention"` MentionAll bool `json:"mention_all"` MentionHere bool `json:"mention_here"` MentionRoles []int64 `json:"mention_roles"` UpdatedAt MilliTimeStamp `json:"updated_at"` MsgID string `json:"msg_id"` } }
func (*MessageUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *MessageUpdateContext) GetCommon() *EventHandlerCommonContext
func (*MessageUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *MessageUpdateContext) GetExtra() interface{}
type MessageUpdateEventHandler ¶ added in v0.0.4
type MessageUpdateEventHandler func(*MessageUpdateContext)
func (MessageUpdateEventHandler) Handle ¶ added in v0.0.4
func (eh MessageUpdateEventHandler) Handle(i EventContext)
func (MessageUpdateEventHandler) New ¶ added in v0.0.4
func (eh MessageUpdateEventHandler) New() EventContext
func (MessageUpdateEventHandler) Type ¶ added in v0.0.4
func (eh MessageUpdateEventHandler) Type() string
type MessageWithAttachment ¶
type MessageWithAttachment struct { Type MessageType `json:"type"` Code string `json:"code"` GuildID string `json:"guild_id"` Attachments Attachment `json:"attachments"` Author User `json:"author"` }
MessageWithAttachment is a message with attachment.
type MilliTimeStamp ¶
type MilliTimeStamp int64
MilliTimeStamp is the timestamp used in kaiheila API.
func MilliTimeStampOfTime ¶ added in v0.0.17
func MilliTimeStampOfTime(t time.Time) MilliTimeStamp
MilliTimeStampOfTime converts the time.Time to MillTimeStamp
func (*MilliTimeStamp) ToTime ¶
func (t *MilliTimeStamp) ToTime() time.Time
ToTime converts the timestamp to golang's time.Time.
type PageInfo ¶
type PageInfo struct { Page int `json:"page"` PageTotal int `json:"page_total"` PageSize int `json:"page_size"` Total int `json:"total"` }
PageInfo is the struct for page info in list GET responses.
type PageSetting ¶
type PageSetting struct { Page *int `json:"page"` PageSize *int `json:"page_size"` Sort *string `json:"sort"` }
PageSetting is the type for page setting in list GET request arguments.
type PermissionOverwrite ¶
type PermissionOverwrite struct { RoleID int64 `json:"role_id"` Allow RolePermission `json:"allow"` Deny RolePermission `json:"deny"` }
PermissionOverwrite is the struct for where needs to customize permission for a role in a channel.
type PrivateMessage ¶
type PrivateMessage struct { MsgID string `json:"msg_id"` AuthorID string `json:"author_id"` TargetID string `json:"target_id"` Content string `json:"content"` ChatCode string `json:"chat_code"` UpdatedAt MilliTimeStamp `json:"updated_at"` DeletedAt MilliTimeStamp `json:"deleted_at"` }
PrivateMessage is the struct for messages in direct chat.
type Quote ¶ added in v0.0.16
type Quote struct { ID string `json:"id"` Type MessageType `json:"type"` Content string `json:"content"` CreateAt MilliTimeStamp `json:"create_at"` Author *User `json:"author"` }
Quote is the struct for quotes in message events.
type ReactedUser ¶
type ReactedUser struct { User ReactionTime MilliTimeStamp `json:"reaction_time"` TagInfo struct { Color string `json:"color"` Text string `json:"text"` } `json:"tag_info"` }
ReactedUser is the type for every user reacted to a specific message with a specific emoji.
type ReactionAddContext ¶ added in v0.0.4
type ReactionAddContext struct { *EventHandlerCommonContext Extra EventReactionItem }
func (*ReactionAddContext) GetCommon ¶ added in v0.0.4
func (ctx *ReactionAddContext) GetCommon() *EventHandlerCommonContext
func (*ReactionAddContext) GetExtra ¶ added in v0.0.4
func (ctx *ReactionAddContext) GetExtra() interface{}
type ReactionAddEventHandler ¶ added in v0.0.4
type ReactionAddEventHandler func(*ReactionAddContext)
func (ReactionAddEventHandler) Handle ¶ added in v0.0.4
func (eh ReactionAddEventHandler) Handle(i EventContext)
func (ReactionAddEventHandler) New ¶ added in v0.0.4
func (eh ReactionAddEventHandler) New() EventContext
func (ReactionAddEventHandler) Type ¶ added in v0.0.4
func (eh ReactionAddEventHandler) Type() string
type ReactionDeleteContext ¶ added in v0.0.4
type ReactionDeleteContext struct { *EventHandlerCommonContext Extra EventReactionItem }
func (*ReactionDeleteContext) GetCommon ¶ added in v0.0.4
func (ctx *ReactionDeleteContext) GetCommon() *EventHandlerCommonContext
func (*ReactionDeleteContext) GetExtra ¶ added in v0.0.4
func (ctx *ReactionDeleteContext) GetExtra() interface{}
type ReactionDeleteEventHandler ¶ added in v0.0.4
type ReactionDeleteEventHandler func(*ReactionDeleteContext)
func (ReactionDeleteEventHandler) Handle ¶ added in v0.0.4
func (eh ReactionDeleteEventHandler) Handle(i EventContext)
func (ReactionDeleteEventHandler) New ¶ added in v0.0.4
func (eh ReactionDeleteEventHandler) New() EventContext
func (ReactionDeleteEventHandler) Type ¶ added in v0.0.4
func (eh ReactionDeleteEventHandler) Type() string
type ReactionItem ¶
type ReactionItem struct { Emoji EmojiItem `json:"emoji"` Count int `json:"count"` Me bool `json:"me"` }
ReactionItem is the reactions for a emoji to a message.
type ReplyOption ¶ added in v0.0.16
type ReplyOption string
ReplyOption is the type providing additional options to Message event reply.
const ( // ReplyOptionTemp let reply temporary. ReplyOptionTemp ReplyOption = "reply_option_temp" )
type RestError ¶ added in v0.0.20
type RestError struct { Code int `json:"code"` Message string `json:"message"` Data json.RawMessage `json:"data"` }
RestError is the error type for errors from khl
type Role ¶
type Role struct { RoleID int64 `json:"role_id"` Name string `json:"name,omitempty"` Color int `json:"color,omitempty"` Position int `json:"position"` Hoist IntBool `json:"hoist,omitempty"` Mentionable IntBool `json:"mentionable,omitempty"` Permissions RolePermission `json:"permissions,omitempty"` }
Role is the struct for a role in the guild.
type RolePermission ¶
type RolePermission int64
RolePermission is the type for the permission of a user in guilds or channels.
const ( RolePermissionAdmin RolePermission = 1 << iota RolePermissionManageGuild RolePermissionViewAuditLog RolePermissionCreateInvite RolePermissionManageInvite RolePermissionManageChannel RolePermissionKickUser RolePermissionBanUser RolePermissionManageGuildEmoji RolePermissionChangeNickname RolePermissionManageRolePermission RolePermissionViewChannel RolePermissionSendMessage RolePermissionManageMessage RolePermissionUploadFile RolePermissionConnectVoice RolePermissionManageVoice RolePermissionMentionEveryone RolePermissionCreateReaction RolePermissionFollowReaction RolePermissionInvitedToVoice RolePermissionForceManualVoice RolePermissionFreeVoice RolePermissionVoice RolePermissionManageUserVoiceReceive RolePermissionManageUserVoiceCreate RolePermissionManageNickname RolePermissionPlayMusic )
These are the permission defined in system.
func (RolePermission) HasPermission ¶
func (r RolePermission) HasPermission(p RolePermission) bool
HasPermission checks if having the provided permission.
type Session ¶
type Session struct { sync.RWMutex Identify Identify LastHeartbeatAck time.Time LastHeartbeatSent time.Time Client *http.Client MaxRetry int RetryTimeout time.Duration ContentType string Logger Logger Sync bool // contains filtered or unexported fields }
Session is the struct for a bot session.
func New ¶
func New(token string, l Logger, o ...SessionOption) (s *Session)
New creates a khl session with default settings
func (*Session) AddHandler ¶
func (s *Session) AddHandler(h interface{}) func()
AddHandler adds event handlers to session, and provides additional type check.
func (*Session) AssetCreate ¶
AssetCreate uploads attachments to khl server.
FYI: https://developer.kaiheila.cn/doc/http/asset#%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6/%E5%9B%BE%E7%89%87
func (*Session) BadgeGuildUrl ¶ added in v0.0.20
BadgeGuildUrl builds the url for guild badge.
func (*Session) BlacklistCreate ¶ added in v0.0.20
func (s *Session) BlacklistCreate(bc *BlacklistCreate) (err error)
BlacklistCreate adds user to blacklist
FYI: https://developer.kaiheila.cn/doc/http/blacklist#%E5%8A%A0%E5%85%A5%E9%BB%91%E5%90%8D%E5%8D%95
func (*Session) BlacklistDelete ¶ added in v0.0.20
BlacklistDelete removes user from blacklist
FYI: https://developer.kaiheila.cn/doc/http/blacklist#%E7%A7%BB%E9%99%A4%E9%BB%91%E5%90%8D%E5%8D%95
func (*Session) BlacklistList ¶ added in v0.0.20
func (s *Session) BlacklistList(guildID string, page *PageSetting) (bi []*BlacklistItem, meta *PageInfo, err error)
BlacklistList lists the users in blacklist.
func (*Session) ChannelCreate ¶
func (s *Session) ChannelCreate(cc *ChannelCreate) (c *Channel, err error)
ChannelCreate creates a channel. FYI: https://developer.kaiheila.cn/doc/http/channel#%E5%88%9B%E5%BB%BA%E9%A2%91%E9%81%93
func (*Session) ChannelDelete ¶
ChannelDelete deletes a channel. FYI: https://developer.kaiheila.cn/doc/http/channel#%E5%88%A0%E9%99%A4%E9%A2%91%E9%81%93
func (*Session) ChannelList ¶
func (s *Session) ChannelList(guildID string, page *PageSetting) (cs []*Channel, meta *PageInfo, err error)
ChannelList lists all channels from a guild. FYI: https://developer.kaiheila.cn/doc/http/channel#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E5%88%97%E8%A1%A8
func (*Session) ChannelMoveUsers ¶
ChannelMoveUsers moves users to a channel. FYI: https://developer.kaiheila.cn/doc/http/channel#%E8%AF%AD%E9%9F%B3%E9%A2%91%E9%81%93%E4%B9%8B%E9%97%B4%E7%A7%BB%E5%8A%A8%E7%94%A8%E6%88%B7
func (*Session) ChannelRoleCreate ¶
func (s *Session) ChannelRoleCreate(crc *ChannelRoleCreate) (crcr *ChannelRoleCreateResp, err error)
ChannelRoleCreate creates a role for a channel FYI: https://developer.kaiheila.cn/doc/http/channel#%E5%88%9B%E5%BB%BA%E9%A2%91%E9%81%93%E8%A7%92%E8%89%B2%E6%9D%83%E9%99%90
func (*Session) ChannelRoleDelete ¶
func (s *Session) ChannelRoleDelete(crd *ChannelRoleDelete) (err error)
ChannelRoleDelete deletes a role form channel setting. FYI: https://developer.kaiheila.cn/doc/http/channel#%E5%88%A0%E9%99%A4%E9%A2%91%E9%81%93%E8%A7%92%E8%89%B2%E6%9D%83%E9%99%90
func (*Session) ChannelRoleIndex ¶
func (s *Session) ChannelRoleIndex(channelID string) (cr *ChannelRoleIndex, err error)
ChannelRoleIndex returns the role and permission list of the channel. FYI: https://developer.kaiheila.cn/doc/http/channel#%E9%A2%91%E9%81%93%E8%A7%92%E8%89%B2%E6%9D%83%E9%99%90%E8%AF%A6%E6%83%85
func (*Session) ChannelRoleUpdate ¶
func (s *Session) ChannelRoleUpdate(cru *ChannelRoleUpdate) (crur *ChannelRoleUpdateResp, err error)
ChannelRoleUpdate updates a role from channel setting. FYI: https://developer.kaiheila.cn/doc/http/channel#%E6%9B%B4%E6%96%B0%E9%A2%91%E9%81%93%E8%A7%92%E8%89%B2%E6%9D%83%E9%99%90
func (*Session) ChannelUserGetJoinedChannel ¶ added in v0.0.20
func (s *Session) ChannelUserGetJoinedChannel(guildID, userID string, page *PageSetting) (us []*UserInVoiceChannel, meta *PageInfo, err error)
ChannelUserGetJoinedChannel gets the user in voice channel
func (*Session) ChannelView ¶
ChannelView returns the detailed information for a channel. FYI: https://developer.kaiheila.cn/doc/http/channel#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E8%AF%A6%E6%83%85
func (*Session) CloseWithCode ¶
CloseWithCode closes a websocket connection with custom websocket closing code.
func (*Session) DirectMessageAddReaction ¶
DirectMessageAddReaction add a reaction to a message as the bot.
func (*Session) DirectMessageCreate ¶
func (s *Session) DirectMessageCreate(create *DirectMessageCreate) (mr *MessageResp, err error)
DirectMessageCreate creates a message in direct chat. FYI: https://developer.kaiheila.cn/doc/http/direct-message#%E5%8F%91%E9%80%81%E7%A7%81%E4%BF%A1%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF
func (*Session) DirectMessageDelete ¶
DirectMessageDelete deletes a message in direct chat. FYI: https://developer.kaiheila.cn/doc/http/direct-message#%E5%88%A0%E9%99%A4%E7%A7%81%E4%BF%A1%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF
func (*Session) DirectMessageDeleteReaction ¶
DirectMessageDeleteReaction deletes a reaction of a user from a message.
func (*Session) DirectMessageList ¶
func (s *Session) DirectMessageList(options ...DirectMessageListOption) (dmrs []*DirectMessageResp, err error)
DirectMessageList returns the messages in direct chat.
func (*Session) DirectMessageReactionList ¶
func (s *Session) DirectMessageReactionList(msgID, emoji string) (us []*ReactedUser, err error)
DirectMessageReactionList returns the list of the reacted users with a specific emoji to a message.
func (*Session) DirectMessageUpdate ¶
func (s *Session) DirectMessageUpdate(update *DirectMessageUpdate) (err error)
DirectMessageUpdate updates a message in direct chat. FYI: https://developer.kaiheila.cn/doc/http/direct-message#%E6%9B%B4%E6%96%B0%E7%A7%81%E4%BF%A1%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF
func (*Session) GameActivity ¶ added in v0.0.20
GameActivity begins playing a game.
func (*Session) GameCreate ¶ added in v0.0.20
func (s *Session) GameCreate(gc *GameCreate) (g *Game, err error)
GameCreate creates a new Game in khl.
func (*Session) GameDelete ¶ added in v0.0.20
GameDelete deletes the Game info in khl
func (*Session) GameDeleteActivity ¶ added in v0.0.20
GameDeleteActivity stops playing a game.
func (*Session) GameList ¶ added in v0.0.20
func (s *Session) GameList(page *PageSetting) (gs []*Game, meta *PageInfo, err error)
GameList lists the games registered.
func (*Session) GameUpdate ¶ added in v0.0.20
func (s *Session) GameUpdate(gu *GameUpdate) (g *Game, err error)
GameUpdate updates the Game info in khl
func (*Session) Gateway ¶
Gateway returns the url for websocket gateway. FYI: https://developer.kaiheila.cn/doc/http/gateway#%E8%8E%B7%E5%8F%96%E7%BD%91%E5%85%B3%E8%BF%9E%E6%8E%A5%E5%9C%B0%E5%9D%80
func (*Session) GuildEmojiCreate ¶
func (s *Session) GuildEmojiCreate(name, guildID string, emoji []byte) (ger *GuildEmojiResp, err error)
GuildEmojiCreate uploads emoji to guild.
func (*Session) GuildEmojiDelete ¶
GuildEmojiDelete deletes an emoji from a guild.
func (*Session) GuildEmojiList ¶
func (s *Session) GuildEmojiList(guildID string, page *PageSetting) (gers []*GuildEmojiResp, meta *PageInfo, err error)
GuildEmojiList returns the list of emojis in a guild
func (*Session) GuildEmojiUpdate ¶
GuildEmojiUpdate updates an emoji's info in a guild.
func (*Session) GuildKickout ¶
GuildKickout force a user to leave a guild. FYI: https://developer.kaiheila.cn/doc/http/guild#%E8%B8%A2%E5%87%BA%E6%9C%8D%E5%8A%A1%E5%99%A8
func (*Session) GuildLeave ¶
GuildLeave let the bot leave a guild. FYI: https://developer.kaiheila.cn/doc/http/guild#%E7%A6%BB%E5%BC%80%E6%9C%8D%E5%8A%A1%E5%99%A8
func (*Session) GuildList ¶
func (s *Session) GuildList(page *PageSetting) (gs []*Guild, meta *PageInfo, err error)
GuildList returns a list of guild that bot joins. FYI: https://developer.kaiheila.cn/doc/http/guild#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E7%94%A8%E6%88%B7%E5%8A%A0%E5%85%A5%E7%9A%84%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%97%E8%A1%A8
func (*Session) GuildMuteCreate ¶
func (s *Session) GuildMuteCreate(gms *GuildMuteSetting) (err error)
GuildMuteCreate revokes a users privilege of using mic or headset. FYI: https://developer.kaiheila.cn/doc/http/guild#%E6%B7%BB%E5%8A%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%9D%99%E9%9F%B3%E6%88%96%E9%97%AD%E9%BA%A6
func (*Session) GuildMuteDelete ¶
func (s *Session) GuildMuteDelete(gms *GuildMuteSetting) (err error)
GuildMuteDelete re-grants a users privilege of using mic or headset. FYI: https://developer.kaiheila.cn/doc/http/guild#%E5%88%A0%E9%99%A4%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%9D%99%E9%9F%B3%E6%88%96%E9%97%AD%E9%BA%A6
func (*Session) GuildMuteList ¶
func (s *Session) GuildMuteList(guildID string) (gml *GuildMuteList, err error)
GuildMuteList returns the list of users got mutes in mic or earphone. FYI: https://developer.kaiheila.cn/doc/http/guild#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%9D%99%E9%9F%B3%E9%97%AD%E9%BA%A6%E5%88%97%E8%A1%A8
func (*Session) GuildNickname ¶
func (s *Session) GuildNickname(gn *GuildNickname) (err error)
GuildNickname changes the nickname of a user in a guild. FYI: https://developer.kaiheila.cn/doc/http/guild#%E4%BF%AE%E6%94%B9%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%AD%E7%94%A8%E6%88%B7%E7%9A%84%E6%98%B5%E7%A7%B0
func (*Session) GuildRoleCreate ¶
GuildRoleCreate creates a role for a guild.
func (*Session) GuildRoleDelete ¶
GuildRoleDelete deletes a role from a guild.
func (*Session) GuildRoleGrant ¶
func (s *Session) GuildRoleGrant(guildID, userID string, roleID int64) (grr *GuildRoleResp, err error)
GuildRoleGrant grants a role to a user.
func (*Session) GuildRoleList ¶
func (s *Session) GuildRoleList(guildID string, page *PageSetting) (rs []*Role, meta *PageInfo, err error)
GuildRoleList returns the roles in a guild. FYI: https://developer.kaiheila.cn/doc/http/guild-role#%E8%8E%B7%E5%8F%96%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%A7%92%E8%89%B2%E5%88%97%E8%A1%A8
func (*Session) GuildRoleRevoke ¶
func (s *Session) GuildRoleRevoke(guildID, userID string, roleID int64) (grr *GuildRoleResp, err error)
GuildRoleRevoke revokes a role from a user.
func (*Session) GuildRoleUpdate ¶
GuildRoleUpdate updates a role for a guild.
func (*Session) GuildUserList ¶
func (s *Session) GuildUserList(guildID string, page *PageSetting, options ...GuildUserListOption) (us []*User, guli *GuildUserListInfo, meta *PageInfo, err error)
GuildUserList returns the list of users in a guild. FYI: https://developer.kaiheila.cn/doc/http/guild#%E8%8E%B7%E5%8F%96%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%AD%E7%9A%84%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8
func (*Session) GuildView ¶
GuildView returns a detailed info for a guild. FYI: https://developer.kaiheila.cn/doc/http/guild#%E8%8E%B7%E5%8F%96%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%AF%A6%E6%83%85
func (*Session) IntimacyIndex ¶
func (s *Session) IntimacyIndex(userID string) (iir *IntimacyIndexResp, err error)
IntimacyIndex returns the intimacy info for a user.
func (*Session) IntimacyUpdate ¶
func (s *Session) IntimacyUpdate(iu *IntimacyUpdate) (err error)
IntimacyUpdate updates the intimacy info for a user.
func (*Session) InviteCreate ¶
func (s *Session) InviteCreate(ic *InviteCreate) (URL string, err error)
InviteCreate creates an invite link.
FYI: https://developer.kaiheila.cn/doc/http/invite#%E5%88%9B%E5%BB%BA%E9%82%80%E8%AF%B7%E9%93%BE%E6%8E%A5
func (*Session) InviteDelete ¶
func (s *Session) InviteDelete(id *InviteDelete) (err error)
InviteDelete deletes an invite link.
FYI: https://developer.kaiheila.cn/doc/http/invite#%E5%88%A0%E9%99%A4%E9%82%80%E8%AF%B7%E9%93%BE%E6%8E%A5
func (*Session) InviteList ¶
func (s *Session) InviteList(page *PageSetting, options ...InviteListOption) (ilrs []*InviteListResp, meta *PageInfo, err error)
InviteList lists invite links of a guild.
FYI: https://developer.kaiheila.cn/doc/http/invite#%E8%8E%B7%E5%8F%96%E9%82%80%E8%AF%B7%E5%88%97%E8%A1%A8
func (*Session) MessageAddReaction ¶
MessageAddReaction add a reaction to a message as the bot. FYI: https://developer.kaiheila.cn/doc/http/message#%E7%BB%99%E6%9F%90%E4%B8%AA%E6%B6%88%E6%81%AF%E6%B7%BB%E5%8A%A0%E5%9B%9E%E5%BA%94
func (*Session) MessageCreate ¶
func (s *Session) MessageCreate(m *MessageCreate) (resp *MessageResp, err error)
MessageCreate creates a message. FYI: https://developer.kaiheila.cn/doc/http/message#%E5%8F%91%E9%80%81%E9%A2%91%E9%81%93%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF
func (*Session) MessageDelete ¶
MessageDelete deletes a message. FYI: https://developer.kaiheila.cn/doc/http/message#%E5%88%A0%E9%99%A4%E9%A2%91%E9%81%93%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF
func (*Session) MessageDeleteReaction ¶
MessageDeleteReaction deletes a reaction of a user from a message. FYI: https://developer.kaiheila.cn/doc/http/message#%E5%88%A0%E9%99%A4%E6%B6%88%E6%81%AF%E7%9A%84%E6%9F%90%E4%B8%AA%E5%9B%9E%E5%BA%94
func (*Session) MessageList ¶
func (s *Session) MessageList(targetID string, options ...MessageListOption) (ms []*DetailedChannelMessage, err error)
MessageList returns a list of messages of a channel. FYI: https://developer.kaiheila.cn/doc/http/message#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF%E5%88%97%E8%A1%A8
func (*Session) MessageReactionList ¶
func (s *Session) MessageReactionList(msgID, emoji string) (us []*ReactedUser, err error)
MessageReactionList returns the list of the reacted users with a specific emoji to a message. FYI: https://developer.kaiheila.cn/doc/http/message#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E6%B6%88%E6%81%AF%E6%9F%90%E5%9B%9E%E5%BA%94%E7%9A%84%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8
func (*Session) MessageUpdate ¶
func (s *Session) MessageUpdate(m *MessageUpdate) (err error)
MessageUpdate updates a message. FYI: https://developer.kaiheila.cn/doc/http/message#%E6%9B%B4%E6%96%B0%E9%A2%91%E9%81%93%E8%81%8A%E5%A4%A9%E6%B6%88%E6%81%AF
func (*Session) Request ¶
Request is the wrapper for internal request method, you would prefer to use other method other than this.
func (*Session) RequestWithPage ¶
func (s *Session) RequestWithPage(method, u string, page *PageSetting) (response []byte, meta *PageInfo, err error)
RequestWithPage is the wrapper for internal list GET request, you would prefer to use other method other than this.
func (*Session) UserChatCreate ¶
UserChatCreate creates a direct chat session. FYI: https://developer.kaiheila.cn/doc/http/user-chat#%E5%88%9B%E5%BB%BA%E7%A7%81%E4%BF%A1%E8%81%8A%E5%A4%A9%E4%BC%9A%E8%AF%9D
func (*Session) UserChatDelete ¶
UserChatDelete deletes a direct chat session. FYI: https://developer.kaiheila.cn/doc/http/user-chat#%E5%88%9B%E5%BB%BA%E7%A7%81%E4%BF%A1%E8%81%8A%E5%A4%A9%E4%BC%9A%E8%AF%9D
func (*Session) UserChatList ¶
func (s *Session) UserChatList(page *PageSetting) (ucs []*UserChat, meta *PageInfo, err error)
UserChatList returns a list of user chats that bot owns.
Note: for User in TargetInfo, only ID, Username, Online, Avatar is filled
func (*Session) UserChatView ¶
UserChatView returns a detailed user chat.
func (*Session) UserMe ¶
UserMe returns the bot info. FYI: https://developer.kaiheila.cn/doc/http/user#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E7%94%A8%E6%88%B7%E4%BF%A1%E6%81%AF
func (*Session) UserOffline ¶ added in v0.0.17
UserOffline logout the bot.
func (*Session) UserView ¶ added in v0.0.9
func (s *Session) UserView(userID string, options ...UserViewOption) (u *User, err error)
UserView returns a user's info FYI: https://developer.kaiheila.cn/doc/http/user#%E8%8E%B7%E5%8F%96%E7%9B%AE%E6%A0%87%E7%94%A8%E6%88%B7%E4%BF%A1%E6%81%AF
func (*Session) WebhookHandler ¶ added in v0.0.8
func (s *Session) WebhookHandler() http.HandlerFunc
WebhookHandler provides a http.HandlerFunc for webhook.
type SessionOption ¶ added in v0.0.8
type SessionOption func(*Session)
SessionOption is the optional arguments for creating a session.
func SessionWithEncryptKey ¶ added in v0.0.8
func SessionWithEncryptKey(key []byte) SessionOption
SessionWithEncryptKey adds the key for decrypting webhook request.
func SessionWithVerifyToken ¶ added in v0.0.8
func SessionWithVerifyToken(token string) SessionOption
SessionWithVerifyToken adds the token for verifying webhook request.
type TextMessageContext ¶ added in v0.0.4
type TextMessageContext struct { *EventHandlerCommonContext Extra struct { MentionRoles []int64 `json:"mention_roles"` MentionHere bool `json:"mention_here"` Author User `json:"author"` Quote *Quote `json:"quote"` GuildID string `json:"guild_id"` ChannelName string `json:"channel_name"` Mention []string `json:"mention"` MentionAll bool `json:"mention_all"` } }
func (*TextMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *TextMessageContext) GetCommon() *EventHandlerCommonContext
func (*TextMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *TextMessageContext) GetExtra() interface{}
func (*TextMessageContext) Reply ¶ added in v0.0.16
func (c *TextMessageContext) Reply(text string, options ...interface{}) (*MessageResp, error)
Reply is a helper function for replying to a message.
It accept optional MessageCreateOption, DirectMessageCreateOption and ReplyOption arguments.
type TextMessageEventHandler ¶ added in v0.0.4
type TextMessageEventHandler func(*TextMessageContext)
func (TextMessageEventHandler) Handle ¶ added in v0.0.4
func (eh TextMessageEventHandler) Handle(i EventContext)
func (TextMessageEventHandler) New ¶ added in v0.0.4
func (eh TextMessageEventHandler) New() EventContext
func (TextMessageEventHandler) Type ¶ added in v0.0.4
func (eh TextMessageEventHandler) Type() string
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` IdentifyNum string `json:"identify_num"` Online bool `json:"online"` Status UserStatus `json:"status"` Avatar string `json:"avatar"` VipAvatar string `json:"vip_avatar"` Bot bool `json:"bot"` MobileVerified bool `json:"mobile_verified"` System bool `json:"system"` MobilePrefix string `json:"mobile_prefix"` Mobile string `json:"mobile"` InviteCount int64 `json:"invite_count"` Nickname string `json:"nickname"` Roles []int64 `json:"roles"` FullName string `json:"full_name"` IsVip bool `json:"is_vip"` JoinedAt MilliTimeStamp `json:"joined_at"` ActiveTime MilliTimeStamp `json:"active_time"` }
User is the struct for a user. Some property may missing.
type UserChat ¶
type UserChat struct { Code string `json:"code"` LastReadTime MilliTimeStamp `json:"last_read_time"` LatestMsgTime MilliTimeStamp `json:"latest_msg_time"` UnreadCount int `json:"unread_count"` IsFriend bool `json:"is_friend"` IsBlocked bool `json:"is_blocked"` IsTargetBlocked bool `json:"is_target_blocked"` TargetInfo User `json:"target_info"` }
UserChat is the struct for DirectMessage or UserChat
type UserInVoiceChannel ¶ added in v0.0.20
type UserInVoiceChannel struct { ID string `json:"id"` GuildID string `json:"guild_id"` MasterID string `json:"master_id"` ParentID string `json:"parent_id"` UserID string `json:"user_id"` Name string `json:"name"` Topic string `json:"topic"` Type ChannelType `json:"type"` Level int `json:"level"` SlowMode int `json:"slow_mode"` LimitAmount int `json:"limit_amount"` IsCategory bool `json:"is_category"` PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"` PermissionUsers []UserPermissionOverwrite `json:"permission_users"` PermissionSync IntBool `json:"permission_sync"` }
UserInVoiceChannel is a user in a voice channel
type UserPermissionOverwrite ¶ added in v0.0.11
type UserPermissionOverwrite struct { User *User `json:"user"` Allow RolePermission `json:"allow"` Deny RolePermission `json:"deny"` }
UserPermissionOverwrite is the struct for where needs to customize permission for a user in a channel.
type UserStatus ¶
type UserStatus int8
UserStatus is the type for user status(banned or not).
const ( UserStatusNormal UserStatus = 1 UserStatusBanned UserStatus = 10 )
These are all the status of a user.
func (UserStatus) IsBanned ¶
func (r UserStatus) IsBanned() bool
IsBanned checks if the user is banned.
type UserUpdateContext ¶ added in v0.0.4
type UserUpdateContext struct { *EventHandlerCommonContext Extra struct { UserID string `json:"user_id"` Username string `json:"username"` Avatar string `json:"avatar"` } }
func (*UserUpdateContext) GetCommon ¶ added in v0.0.4
func (ctx *UserUpdateContext) GetCommon() *EventHandlerCommonContext
func (*UserUpdateContext) GetExtra ¶ added in v0.0.4
func (ctx *UserUpdateContext) GetExtra() interface{}
type UserUpdateEventHandler ¶
type UserUpdateEventHandler func(*UserUpdateContext)
func (UserUpdateEventHandler) Handle ¶
func (eh UserUpdateEventHandler) Handle(i EventContext)
func (UserUpdateEventHandler) New ¶
func (eh UserUpdateEventHandler) New() EventContext
func (UserUpdateEventHandler) Type ¶
func (eh UserUpdateEventHandler) Type() string
type UserViewOption ¶ added in v0.0.9
UserViewOption is the optional arguments for UserView requests.
func UserViewWithGuildID ¶ added in v0.0.9
func UserViewWithGuildID(guildID string) UserViewOption
UserViewWithGuildID add the optional `guild_id` arguments to UserView request
type VideoMessageContext ¶ added in v0.0.4
type VideoMessageContext struct { *EventHandlerCommonContext Extra EventRichMessage }
func (*VideoMessageContext) GetCommon ¶ added in v0.0.4
func (ctx *VideoMessageContext) GetCommon() *EventHandlerCommonContext
func (*VideoMessageContext) GetExtra ¶ added in v0.0.4
func (ctx *VideoMessageContext) GetExtra() interface{}
type VideoMessageEventHandler ¶ added in v0.0.4
type VideoMessageEventHandler func(*VideoMessageContext)
func (VideoMessageEventHandler) Handle ¶ added in v0.0.4
func (eh VideoMessageEventHandler) Handle(i EventContext)
func (VideoMessageEventHandler) New ¶ added in v0.0.4
func (eh VideoMessageEventHandler) New() EventContext
func (VideoMessageEventHandler) Type ¶ added in v0.0.4
func (eh VideoMessageEventHandler) Type() string