Categorygithub.com/Quinlivanner/kook-golang-sdk
modulepackage
1.0.4
Repository: https://github.com/quinlivanner/kook-golang-sdk.git
Documentation: pkg.go.dev

# README

Kook

A low level library for interacting with Kook bot API. Currently, it is WIP.

Go Reference Go Report Card Server Badger FOSSA Status

Get Started

It is not recommended to use it in production until it releases v1.0.0.

Installing

This assumes that you already have a working Go environment.

go get github.com/lonelyevil/kook

Other than the library itself, you need to install a logger and an adapter for logger. Personally, I only implement the adapter for phuslu/log. So, in order to use the library, the following installation is necessary.

go get github.com/lonelyevil/kook/log_adapter/plog

Usage

See the examples in examples folder.

Features and Roadmap

See features.md.

Documentation

WIP.

For code that are not well commented, users could refer to bwmarrin/discordgo as this library is heavily influenced by it.

Versioning

I could not guarantee a stable API until the release of 1.0.0. Before that, any break change would happen. After that, It would follow semantic versioning.

Contributing

Currently, this repo does not accept any large PRs, as the API may be broken at any time when I want. Bug reports and code suggestions are greatly welcomed.

LICENSE

kook is a free and open source software library distributed under the terms of ISC License.

FOSSA Status

Special Thanks To:

GoLand logo

Built using IntelliJ IDEA

# Functions

DirectMessageCreateWithCard changes message type to card.
DirectMessageCreateWithKmarkdown changes message type to Kmarkdown.
DirectMessageListWithChatCode adds optional `chat_code` argument to DirectMessageList request.
DirectMessageListWithFlag adds optional `flag` argument to DirectMessageList request.
DirectMessageListWithMsgID adds optional `msg_id` argument to DirectMessageList request.
DirectMessageListWithTargetID adds optional `target_id` argument to DirectMessageList request.
GuildUserListWithActiveTime adds optional `active_time` argument to GuildUserList request.
GuildUserListWithChannelID adds optional `channel_id` argument to GuildUserList request.
GuildUserListWithJoinedAt adds optional `joined_at` argument to GuildUserList request.
GuildUserListWithMobileVerified adds optional `mobile_verified` argument to GuildUserList request.
GuildUserListWithRoleID adds optional `role_id` argument to GuildUserList request.
GuildUserListWithSearch adds optional `search` argument to GuildUserList request.
InviteListWithChannelID adds optional `channel_id` argument to InviteList request.
InviteListWithGuildID adds optional `guild_id` argument to InviteList request.
MessageCreateWithCard changes message type to card.
MessageCreateWithKmarkdown changes message type to Kmarkdown.
MessageListWithFlag adds optional `flag` argument to MessageList request.
MessageListWithMsgID adds optional `msg_id` argument to MessageList request.
MessageListWithPageSize adds optional `page_size` argument to MessageList request.
MessageListWithPin adds optional `pin` argument to MessageList request.
MilliTimeStampOfTime converts the time.Time to MillTimeStamp.
New creates a kook session with default settings.
SessionWithEncryptKey adds the key for decrypting webhook request.
SessionWithVerifyToken adds the token for verifying webhook request.
UserViewWithGuildID add the optional `guild_id` arguments to UserView request.

# Constants

These are predefined usable CardMessageCountdownModes.
These are predefined usable CardMessageCountdownModes.
These are predefined usable CardMessageCountdownModes.
These are predefined usable CardMessageElementButtonClicks.
These are predefined usable CardMessageElementButtonClicks.
These are predefined usable CardMessageFileTypes.
These are predefined usable CardMessageFileTypes.
These are predefined usable CardMessageFileTypes.
These are predefined usable CardMessageSectionModes.
These are predefined usable CardMessageSectionModes.
These are predefined usable card sizes.
These are predefined usable card sizes.
These are predefined usable card themes.
These are predefined usable card themes.
These are predefined usable card themes.
These are predefined usable card themes.
These are predefined usable card themes.
These are predefined usable card themes.
These are predefined usable card themes.
These are all channel types.
These are all channel types.
All event signal consts.
All event signal consts.
All event signal consts.
All event signal consts.
All event signal consts.
All event signal consts.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
EventStatusCode consts for event status.
These are all GameType values.
These are all GameType values.
These are all GameType values.
These are all notify types.
These are all notify types.
These are all notify types.
These are all notify types.
These are allowed InviteDuration enums.
These are allowed InviteDuration enums.
These are allowed InviteDuration enums.
These are allowed InviteDuration enums.
These are allowed InviteDuration enums.
These are allowed InviteDuration enums.
These are allowed InviteDuration enums.
These are allowed InviteSettingTimes enums.
These are allowed InviteSettingTimes enums.
These are allowed InviteSettingTimes enums.
These are allowed InviteSettingTimes enums.
These are allowed InviteSettingTimes enums.
These are allowed InviteSettingTimes enums.
These are allowed InviteSettingTimes enums.
These are the usable flags.
These are the usable flags.
These are the usable flags.
MessageType consts for event message type.
MessageType consts for event message type.
MessageType consts for event message type.
MessageType consts for event message type.
MessageType consts for event message type.
MessageType consts for event message type.
MessageType consts for event message type.
MessageType consts for event message type.
No description provided by the author
No description provided by the author
No description provided by the author
These are all mute types.
These are all mute types.
ReplyOptionTemp let reply temporary.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are the permission defined in system.
These are all the status of a user.
These are all the status of a user.

# Variables

All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
EndpointChannelMessage is Deprecated.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
All endpoints for http request.
ErrWSAlreadyOpen is the error when connecting with connected websocket.

# Structs

Attachment is the struct for various attachments, so that according to type, some fields may be empty.
No description provided by the author
BlacklistCreate is the type for arguments of BlacklistCreate request.
BlacklistItem is one user in blacklist.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CardMessageCard is the type for 卡片.
CardMessageCountdown is the type for 模块-倒计时模块.
CardMessageDivider is the type for 模块-分割线模块.
CardMessageElementButton is the type for 元素-按钮.
CardMessageElementImage is the type for 元素-图片.
CardMessageElementKMarkdown is the type for 元素-kmarkdown.
CardMessageElementText is the type for 元素-普通文本.
CardMessageFile is the type for 模块-文件模块.
CardMessageHeader is the type for 模块-标题模块.
CardMessageInvite is the type for 邀请模块.
CardMessageParagraph is the type for 结构体-区域文本.
CardMessageSection is the type for 模块-内容模块.
Channel is the struct for a channel in guild.
No description provided by the author
ChannelCreate is the arguments for creating a channel.
No description provided by the author
ChannelMessage is the struct for a message in a channel.
ChannelRoleBase is the common arguments for channel role requests.
ChannelRoleIndex is the role and permission list of a channel.
ChannelRoleUpdate is the request query data for ChannelRoleUpdate.
ChannelRoleUpdateResp is the response of ChannelRoleUpdate.
No description provided by the author
DetailedChannelMessage is the struct for a detailed message in a channel.
DirectMessageCreate is the struct for settings of creating a message in direct chat.
No description provided by the author
No description provided by the author
No description provided by the author
DirectMessageResp is the type for direct messages.
No description provided by the author
EmojiItem is the type for an emoji.
EndpointGeneralResponse is the struct for initial parsing REST requests.
Event is the struct for every received event.
No description provided by the author
No description provided by the author
EventData is the struct for initial parsing event's data payload.
EventDataGeneral is the struct passed to all event handler.
EventDataHello is the struct for the data of event hello.
EventDataResumeAck is the struct for the data of event resume ack.
EventDataSystem is the struct for initial parsing system events.
No description provided by the author
No description provided by the author
No description provided by the author
EventHandlerCommonContext is the common context for event handlers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
revive:disable.
No description provided by the author
No description provided by the author
Game is a game item registered at kook.
GameActivityMusicBody is the necessary data for music activity.
GameCreate is the type for arguments of GameCreate request.
GameUpdate is the type for arguments of GameUpdate request.
GeneralListData is the struct for list GET responses.
Guild is the struct for a server/guild(服务器).
No description provided by the author
No description provided by the author
No description provided by the author
GuildEmojiResp is the type for response of GuildEmojiList request.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GuildMuteList is the type for users that got muted in a guild.
GuildMuteSetting is the type for arguments of GuildMuteSetting.
GuildNickname is the arguments for GuildNickname.
No description provided by the author
No description provided by the author
GuildRoleResp is the response of GuildRoleGrant request.
No description provided by the author
No description provided by the author
No description provided by the author
Identify is the struct for the initial settings sent to kookapp.
No description provided by the author
IntimacyIndexResp is the type for intimacy info.
IntimacyUpdate is the type for arguments for IntimacyUpdate request.
InviteCreate is the type for arguments of InviteCreate request.
InviteDelete is the type for arguments of InviteDelete request.
InviteListResp is the type for response of InviteList request.
No description provided by the author
No description provided by the author
MessageCreate is the type for message creation arguments.
MessageCreateBase is the common arguments for message creation.
No description provided by the author
No description provided by the author
MessageReaction is the struct for reactions embedded to a message.
MessageResp is the type for response for MessageCreate.
No description provided by the author
MessageUpdate is the request data for MessageUpdate.
MessageUpdateBase is the shared arguments for message update related requests.
No description provided by the author
MessageWithAttachment is a message with attachment.
PageInfo is the struct for page info in list GET responses.
PageSetting is the type for page setting in list GET request arguments.
PermissionOverwrite is the struct for where needs to customize permission for a role in a channel.
PrivateMessage is the struct for messages in direct chat.
Quote is the struct for quotes in message events.
ReactedUser is the type for every user reacted to a specific message with a specific emoji.
No description provided by the author
No description provided by the author
ReactionItem is the reactions for a emoji to a message.
RestError is the error type for errors from kook.
Role is the struct for a role in the guild.
Session is the struct for a bot session.
No description provided by the author
User is the struct for a user.
UserChat is the struct for DirectMessage or UserChat.
UserInVoiceChannel is a user in a voice channel.
UserPermissionOverwrite is the struct for where needs to customize permission for a user in a channel.
No description provided by the author
No description provided by the author

# Interfaces

Entry
Entry is the interface which external loggers' entry should meet.
EventContext is the interface for objects containing context for event handlers.
EventHandler is the interface for objects handling event.
EventHandlerProvider is the interface for objects providing event handlers.
Logger is the interface which external loggers should meet.
SnStore is the interface for storing sequence numbers.

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CardMessage is the type for a message of cards called 卡片消息.
CardMessageActionGroup is the type for 模块-交互模块.
CardMessageContainer is the type for 可拓展图片模块.
CardMessageContext is the type for 模块-备注模块.
CardMessageCountdownMode is the type for modes of CardMessageCountdown.
CardMessageElementButtonClick is the type for click modes of CardMessageElementButton.
CardMessageFileType is the type for types of CardMessageFile.
CardMessageImageGroup is the type for 图片模块.
CardMessageSectionMode is the type of mode for CardMessageSection.
No description provided by the author
CardSize is the type for card size.
CardTheme is the type for card theme.
No description provided by the author
No description provided by the author
ChannelRoleCreate is the request query data for ChannelRoleCreate.
ChannelRoleCreateResp is the response for ChannelRoleCreate.
ChannelRoleDelete is the type for settings when deleting a role from channel setting.
ChannelType is the type of a channel.
No description provided by the author
DirectMessageCreateOption is the type for decorator of DirectMessageCreate.
No description provided by the author
DirectMessageListOption is the type for optional arguments for DirectMessageList request.
No description provided by the author
No description provided by the author
DirectMessageUpdate is the type for settings of updating a message in direct chat.
No description provided by the author
No description provided by the author
EventSignal is the type for event types.
EventStatusCode is the type for various event status code.
No description provided by the author
GameType is an enum for Game's type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GuildNotifyType is the type of the notify type of a guild.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GuildUserListOption is the type for optional arguments for GuildUserList request.
No description provided by the author
IntBool is the type for some int value in response which only has two valid values.
InviteDuration is the type for Duration in InviteCreate You MUST use the enum defined below.
InviteListOption is the optional arguments for InviteList requests.
InviteSettingTimes is the type for SettingTimes in InviteCreate You SHOULD use the enum defined below.
No description provided by the author
No description provided by the author
MessageCreateOption is the type for decorator of MessageCreate.
No description provided by the author
MessageListFlag is the type for the flag of MessageList.
MessageListOption is the type for optional arguments for MessageList request.
No description provided by the author
MessageType is the type for messages from events.
No description provided by the author
No description provided by the author
MilliTimeStamp is the timestamp used in kookapp API.
MusicSoftware is the types for predefined music software.
MuteType is the type for mute status.
No description provided by the author
No description provided by the author
ReplyOption is the type providing additional options to Message event reply.
RolePermission is the type for the permission of a user in guilds or channels.
SessionOption is the optional arguments for creating a session.
No description provided by the author
UserStatus is the type for user status(banned or not).
No description provided by the author
UserViewOption is the optional arguments for UserView requests.
No description provided by the author