Documentation ¶
Index ¶
- Constants
- func DoRequest(method string, endpoint string, body []byte, token string) ([]byte, error)
- type AllMessagesResponse
- type AnncounmentResponse
- type Announcement
- type AnnouncementService
- type AwardXPResponse
- type BotServerMembershipCreated
- type BotServerMembershipDeleted
- type CalendarEvent
- type CalendarEventCreated
- type CalendarEventDeleted
- type CalendarEventResponse
- type CalendarEventRsvp
- type CalendarEventRsvpResponse
- type CalendarEventRsvpsResponse
- type CalendarEventUpdated
- type CalendarEventsResponse
- type CalendarService
- type CalenderEventObject
- type Category
- type CategoryService
- type ChannelArchived
- type ChannelRestored
- type ChannelService
- type ChatEmbed
- type ChatEmbedAuthor
- type ChatEmbedField
- type ChatEmbedFooter
- type ChatEmbedImage
- type ChatEmbedThumbnail
- type ChatMessage
- type ChatMessageCreated
- type ChatMessageDeleted
- type ChatMessageUpdated
- type Client
- func (c *Client) Close()
- func (c *Client) Command(cmd string, callback func(client *Client, v *ChatMessageCreated))
- func (c *Client) DeleteRequest(endpoint string) ([]byte, error)
- func (c *Client) GetRequest(endpoint string) ([]byte, error)
- func (c *Client) GetRequestV2(endpoint string, v any) error
- func (c *Client) On(event string, callback func(client *Client, v any))
- func (c *Client) Open()
- func (c *Client) PatchRequest(endpoint string, body any, v any) error
- func (c *Client) PostRequest(endpoint string, body interface{}) ([]byte, error)
- func (c *Client) PostRequestV2(endpoint string, body any, v any) error
- func (c *Client) PutRequest(endpoint string, body interface{}) ([]byte, error)
- func (c *Client) PutRequestV2(endpoint string, body interface{}, v any) error
- type Command
- type CommandService
- type CommandsBuilder
- type Config
- type CreateCategory
- type Doc
- type DocComment
- type DocCommentService
- type DocCreated
- type DocDeleted
- type DocObject
- type DocResponse
- type DocUpdated
- type DocsResponse
- type DocsService
- type Emote
- type Event
- type ForumCommentObject
- type ForumService
- type ForumTopic
- type ForumTopicComment
- type ForumTopicCommentCreated
- type ForumTopicCommentDeleted
- type ForumTopicCommentUpdated
- type ForumTopicCreated
- type ForumTopicDeleted
- type ForumTopicLocked
- type ForumTopicObject
- type ForumTopicPinned
- type ForumTopicReactionCreated
- type ForumTopicReactionDeleted
- type ForumTopicSummary
- type ForumTopicUnlocked
- type ForumTopicUnpinned
- type ForumTopicUpdated
- type GetAnnouncementParams
- type GetEventsOptions
- type GetMessageResponse
- type GetMessagesObject
- type ListItem
- type ListItemSummary
- type ListObject
- type ListService
- type MembersService
- type Mentions
- type MentionsChannel
- type MentionsRole
- type MentionsUser
- type MessageObject
- type MessageResponse
- type NewChannelObject
- type NicknameResponse
- type RawEvent
- type RawEvent2
- type ReactionService
- type RoleService
- type Server
- type ServerChannel
- type ServerChannelCreated
- type ServerChannelDeleted
- type ServerChannelResponse
- type ServerChannelUpdated
- type ServerMember
- type ServerMemberBan
- type ServerMemberBanned
- type ServerMemberJoined
- type ServerMemberPermissions
- type ServerMemberRemoved
- type ServerMemberResponse
- type ServerMemberSummary
- type ServerMemberUnbanned
- type ServerMemberUpdated
- type ServerResponse
- type ServerRolesUpdated
- type ServerService
- type ServerWebhookCreated
- type ServerWebhookUpdated
- type ServerXPService
- type SocialLink
- type SocialResponse
- type SocialsService
- type UpdateChannelObject
- type UpdateTopicObject
- type User
- type UserResponse
- type UserService
- type UserStatus
- type UserStatusUpdate
- type UserSummary
- type Webhook
- type WebhookObject
- type WebhookService
- type WelcomeOP
- type XPObject
Constants ¶
View Source
const ( ChannelTypeAnnouncements string = "announcements" ChannelTypeChat string = "chat" ChannelTypeCalendar string = "calendar" ChannelTypeForums string = "forums" ChannelTypeMedia string = "media" ChannelTypeDocs string = "docs" ChannelTypeVoice string = "voice" ChannelTypeList string = "list" ChannelTypeScheduling string = "scheduling" ChannelTypeStream string = "stream" )
View Source
const ( ChatMessageTypeDefault string = "default" ChatMessageTypeSystem string = "system" )
View Source
const ( ServerTypeTeam string = "team" ServerTypeOrganization string = "organization" ServerTypeCommunity string = "community" ServerTypeClan string = "clan" ServerTypeGuild string = "guild" ServerTypeFriends string = "friends" ServerTypeStreaming string = "streaming" ServerTypeOther string = "other" )
View Source
const ( UserTypeUser = "user" UserTypeBot = "bot" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AllMessagesResponse ¶
type AllMessagesResponse struct {
Messages []ChatMessage `json:"messages"`
}
type AnncounmentResponse ¶ added in v0.5.2
type AnncounmentResponse struct {
Announcement `json:"announcement"`
}
type Announcement ¶ added in v0.5.2
type AnnouncementService ¶ added in v0.5.2
type AnnouncementService interface { CreateAnnouncement(serverID string, channelID string, title string, content string) (*Announcement, error) GetAnnouncements(channelID string, query *GetAnnouncementParams) ([]Announcement, error) ReadAnnouncement(channelID string, announcementID string) (*Announcement, error) UpdateAnnouncement(channelID string, announcementID string, title string, content string) (*Announcement, error) DeleteAnnouncement(channelID string, announcementID string) error }
type AwardXPResponse ¶ added in v0.4.0
type AwardXPResponse struct {
Total int `json:"total"`
}
type BotServerMembershipCreated ¶ added in v0.1.4
type BotServerMembershipDeleted ¶ added in v0.1.4
type CalendarEvent ¶ added in v0.2.0
type CalendarEvent struct { ID int `json:"id"` ServerID string `json:"serverId"` ChannelID string `json:"channelId"` Name string `json:"name"` Description string `json:"description,omitempty"` Location string `json:"location,omitempty"` URL string `json:"url,omitempty"` Color int `json:"color,omitempty"` RSVPLimit int `json:"rsvpLimit,omitempty"` StartsAt string `json:"startsAt"` Duration int `json:"duration,omitempty"` IsPrivate bool `json:"isPrivate,omitempty"` Mentions `json:"mentions,omitempty"` CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` Cancellation struct { Description string `json:"description,omitempty"` CreatedBy string `json:"createdBy,omitempty"` } `json:"cancellation,omitempty"` }
type CalendarEventCreated ¶ added in v0.2.0
type CalendarEventCreated struct { ServerID string `json:"serverId"` CalendarEvent `json:"calendarEvent"` }
type CalendarEventDeleted ¶ added in v0.2.0
type CalendarEventDeleted struct { ServerID string `json:"serverId"` CalendarEvent `json:"calendarEvent"` }
type CalendarEventResponse ¶ added in v0.2.0
type CalendarEventResponse struct {
Event CalendarEvent `json:"calendarEvent"`
}
type CalendarEventRsvp ¶ added in v0.2.0
type CalendarEventRsvp struct { CalendarEventID int `json:"calendarEventId"` ChannelID string `json:"channelId"` ServerID string `json:"serverId"` UserID string `json:"userId"` Status string `json:"status"` CreatedBy string `json:"createdBy"` CreatedAt string `json:"createdAt"` UpdatedBy string `json:"updatedBy"` UpdatedAt string `json:"updatedAt"` }
type CalendarEventRsvpResponse ¶ added in v0.2.1
type CalendarEventRsvpResponse struct {
Rsvp CalendarEventRsvp `json:"calendarEventRsvp"`
}
type CalendarEventRsvpsResponse ¶ added in v0.2.1
type CalendarEventRsvpsResponse struct {
Rsvps []CalendarEventRsvp `json:"calendarEventRsvps"`
}
type CalendarEventUpdated ¶ added in v0.2.0
type CalendarEventUpdated struct { ServerID string `json:"serverId"` CalendarEvent `json:"calendarEvent"` }
type CalendarEventsResponse ¶ added in v0.2.0
type CalendarEventsResponse struct {
Events []CalendarEvent `json:"calendarEvents"`
}
type CalendarService ¶ added in v0.2.0
type CalendarService interface { CreateEvent(channelId string, event *CalenderEventObject) (*CalendarEvent, error) GetEvents(channelId string, options *GetEventsOptions) ([]CalendarEvent, error) GetEvent(channelId string, eventId int) (*CalendarEvent, error) UpdateEvent(channelId string, eventId int, event *CalenderEventObject) (*CalendarEvent, error) DeleteEvent(channelId string, eventId int) error GetEventRSVP(channelId string, eventId int, userId string) (*CalendarEventRsvp, error) CreateOrUpdateEventRSVP(channelId string, eventId int, userId string) (*CalendarEventRsvp, error) DeleteEventRSVP(channelId string, eventId int, userId string) error GetEventRSVPs(channelId string, eventId int) ([]CalendarEventRsvp, error) }
type CalenderEventObject ¶ added in v0.2.1
type CalenderEventObject struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Location string `json:"location,omitempty"` StartsAt string `json:"startsAt,omitempty"` URL string `json:"url,omitempty"` Color int `json:"color,omitempty"` RSVPLimit int `json:"rsvpLimit,omitempty"` Duration int `json:"duration,omitempty"` IsPrivate bool `json:"isPrivate,omitempty"` }
type CategoryService ¶ added in v1.1.0
type ChannelArchived ¶ added in v1.0.0
type ChannelArchived struct { ServerID string `json:"serverId"` Channel ServerChannel `json:"channel"` }
type ChannelRestored ¶ added in v1.0.0
type ChannelRestored struct { ServerID string `json:"serverId"` Channel ServerChannel `json:"channel"` }
type ChannelService ¶
type ChannelService interface { CreateChannel(channelObject *NewChannelObject) (*ServerChannel, error) GetChannel(channelId string) (*ServerChannel, error) UpdateChannel(channelId string, channelObject *UpdateChannelObject) (*ServerChannel, error) DeleteChannel(channelId string) error SendMessage(channelId string, message *MessageObject) (*ChatMessage, error) GetMessages(channelId string, getObject *GetMessagesObject) (*[]ChatMessage, error) GetMessage(channelId string, messageId string) (*ChatMessage, error) UpdateChannelMessage(channelId string, messageId string, newMessage *MessageObject) (*ChatMessage, error) DeleteChannelMessage(channelId string, messageId string) error }
type ChatEmbed ¶ added in v0.1.4
type ChatEmbed struct { // Main header of the embed (max length 256) Title string `json:"embed,omitempty"` // Subtext of the embed (max length 2048) Description string `json:"description,omitempty"` // URL to linkify the title field with (max length 1024; regex ^(?!attachment)) URL string `json:"url,omitempty"` // Decimal value of the color that the left border should be (min 0; max 16777215) Color int `json:"color,omitempty"` Footer ChatEmbedFooter `json:"footer,omitempty"` // A timestamp to put in the footer Timestamp string `json:"timestamp,omitempty"` // An image to the right of the embed's content Thumbnail ChatEmbedThumbnail `json:"thumbnail,omitempty"` // The main picture to associate with the embed Image ChatEmbedImage `json:"image"` // A small section above the title of the embed Author ChatEmbedAuthor `json:"author,omitempty"` // Table-like cells to add to the embed (max items 25) Fields []ChatEmbedField `json:"fields,omitempty"` }
ChatEmbed are rich content sections optionally associated with chat messages. Properties with "webhook-markdown" support allow for the following: link, italic, bold, strikethrough, underline, inline code, block code, reaction, and mention.
type ChatEmbedAuthor ¶ added in v0.1.4
type ChatEmbedAuthor struct { // Name of the author (max length 256) Name string `jsojn:"name,omitempty"` // URL to linkify the author's name field (max length 1024; regex ^(?!attachment)) URL string `json:"url,omitempty"` // URL of a small image to display to the left of the author's name (max length 1024 IconURL string `json:"icon_url,omitempty"` }
type ChatEmbedField ¶ added in v0.1.4
type ChatEmbedFooter ¶ added in v0.1.4
type ChatEmbedImage ¶ added in v0.1.4
type ChatEmbedImage struct { // URL of the image (max length 1024) URL string `json:"url,omitempty"` }
type ChatEmbedThumbnail ¶ added in v0.1.4
type ChatEmbedThumbnail struct { // URL of the image (max length 1024) URL string `json:"url,omitempty"` }
type ChatMessage ¶
type ChatMessage struct { // The ID of the message ID string `json:"id"` // The type of chat message. // "system" messages are generated by Guilded, while "default" messages are user or bot-generated. Type string `json:"type,omitempty"` // The ID of the server ServerID string `json:"serverId,omitempty"` GroupID string `json:"groupId,omitempty"` // The ID of the channel ChannelID string `json:"channelId"` // The content of the message Content string `json:"content,omitempty"` // Embeds for the message. // // (min items 1; max items 10 Embeds []ChatEmbed `json:"embeds,omitempty"` // Message IDs that were replied to ReplyMessageIds []string `json:"replyMessageIds,omitempty"` // If set, this message will only be seen by those mentioned or replied to. IsPrivate bool `json:"isPrivate,omitempty"` // If set, this message did not notify mention or reply recipients (default false) IsSilent bool `json:"isSilent,omitempty"` Mentions `json:"mentions,omitempty"` // The ISO 8601 timestamp that the message was created at. CreatedAt string `json:"createdAt"` // The ID for the user who created this messsage // (Note: if this event has `createdByWebhookId` present, // this field will still be populated, but can be ignored. // In this case, the value of this field will always be Ann6LewA) CreatedBy string `json:"createdBy"` // The ID of the webhook who created this message, if was created by a webhook CreatedByWebhookId string `json:"createdByWebhookId,omitempty"` // The IOSO 8601 timestamp that the message was updated at, if relevant UpdatedAt string `json:"updatedAt,omitempty"` }
ChatMessage is the default message struct
type ChatMessageCreated ¶ added in v0.1.2
type ChatMessageCreated struct { // The ID of the server ServerID string `json:"serverId"` Message ChatMessage `json:"message"` }
type ChatMessageDeleted ¶ added in v0.1.4
type ChatMessageDeleted struct { // The ID of the server ServerID string `json:"serverId"` Message struct { // The ID of the message ID string `json:"id"` // The ID of the serve ServerID string `json:"serverId,omitempty"` // The ID of the channel ChannelID string `json:"channelId"` DeletedAt string `json:"deletedAt"` IsPrivate bool `json:"isPrivate,omitempty"` } `json:"message"` }
type ChatMessageUpdated ¶ added in v0.1.4
type ChatMessageUpdated struct { // The ID of the server ServerID string `json:"serverId"` Message ChatMessage `json:"message"` }
type Client ¶
type Client struct { sync.RWMutex Token string ServerID string Channel ChannelService Members MembersService Roles RoleService Server ServerService Forums ForumService Calendar CalendarService Reactions ReactionService List ListService Webhooks WebhookService ServerXP ServerXPService CommandService CommandService DocComments DocCommentService Docs DocsService Socials SocialsService Announcements AnnouncementService Category CategoryService Users UserService // contains filtered or unexported fields }
func (*Client) Command ¶ added in v0.1.3
func (c *Client) Command(cmd string, callback func(client *Client, v *ChatMessageCreated))
Command listens to ChatMessageCreated and fires a func when the message content matches the command
func (*Client) GetRequestV2 ¶ added in v0.1.3
func (*Client) PatchRequest ¶ added in v0.1.4
func (*Client) PostRequest ¶
func (*Client) PostRequestV2 ¶ added in v0.1.4
func (*Client) PutRequest ¶
type Command ¶ added in v0.4.1
type Command struct { CommandName string Action func(client *Client, v *ChatMessageCreated) }
type CommandService ¶ added in v0.4.1
type CommandService interface { AddCommand(command *Command) AddCommands(commands *CommandsBuilder) }
type CommandsBuilder ¶ added in v0.4.1
type CommandsBuilder struct {
Commands []Command
}
type CreateCategory ¶ added in v1.1.0
type Doc ¶ added in v0.2.0
type Doc struct { ID int `json:"id"` ServerID string `json:"serverId"` ChannelID string `json:"channelId"` Title string `json:"title"` Content string `json:"content"` Mentions `json:"mentions,omitempty"` CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` UpdatedAt string `json:"updatedAt,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` }
type DocComment ¶ added in v0.4.1
type DocCommentService ¶ added in v0.4.3
type DocCommentService interface { Create(channelID string, docID int, content string) (*DocComment, error) GetComments(channelID string, docID int) ([]DocComment, error) GetDocComment(channelID string, docID int, commentID int) (*DocComment, error) UpdateDocComment(channelID string, docID int, commentID int, content string) (*DocComment, error) DeleteDocComment(channelID string, docID int, commentID int) error }
type DocCreated ¶ added in v0.2.0
type DocDeleted ¶ added in v0.2.0
type DocObject ¶ added in v0.3.0
type DocObject struct {
// contains filtered or unexported fields
}
type DocResponse ¶ added in v0.3.0
type DocResponse struct {
Doc `json:"doc"`
}
type DocUpdated ¶ added in v0.2.0
type DocsResponse ¶ added in v0.3.0
type DocsResponse struct {
Docs []Doc `json:"docs"`
}
type DocsService ¶ added in v0.3.0
type ForumCommentObject ¶ added in v0.2.0
type ForumCommentObject struct {
Content string `json:"content"`
}
type ForumService ¶ added in v0.2.0
type ForumService interface { CreateForumTopic(channelId string, forumTopicObject *ForumTopicObject) (*ForumTopic, error) GetForumTopics(channelId string) (*[]ForumTopicSummary, error) GetForumTopic(channelId string, forumTopicId int) (*ForumTopic, error) UpdateForumTopic(channelId string, forumTopicId int, updateTopicObject *UpdateTopicObject) (*ForumTopic, error) DeleteForumTopic(channelId string, forumTopicId int) error PinForumTopic(channelId string, forumTopicId int) error UnpinForumTopic(channelId string, forumTopicId int) error LockForumTopic(channelId string, forumTopicId int) error UnlockForumTopic(channelId string, forumTopicId int) error CreateTopicComment(channelId string, forumTopicId int, forumCommentObject *ForumCommentObject) (*ForumTopicComment, error) }
type ForumTopic ¶ added in v0.1.4
type ForumTopic struct { // The ID of the forum topic ID int `json:"id"` // The ID of the server ServerID string `json:"serverId"` // The ID of the channel ChannelID string `json:"channelId"` // The title of the forum topic (min length 1; max length 500) Title string `json:"title"` // The ISO 8601 timestamp that the forum topic was created at CreatedAt string `json:"createdAt"` // The ID of the user who created this forum topic // (Note: If this event has createdByWebhookId present, this field will still be populated, // but can be ignored. In this case, the value of this field will always be Ann6LewA) CreatedBy string `json:"createdBy"` // The ID of the webhook who created this forum topic, if it was created by a webhook CreatedByWebhookID string `json:"createdByWebhookId,omitempty"` // The ISO 8601 timestamp that the forum topic was updated at, if relevant UpdatedAt string `json:"updatedAt,omitempty"` // The ISO 8601 timestamp that the forum topic was bumped at. // This timestamp is updated whenever there is any activity on the posts within the forum topic. BumpedAt string `json:"bumpedAt,omitempty"` // (default false) IsPinned bool `json:"isPinned,omitempty"` // (default false) IsLocked bool `json:"isLocked,omitempty"` // The content of the forum topic Content string `json:"content"` Mentions `json:"mentions,omitempty"` }
type ForumTopicComment ¶ added in v0.2.0
type ForumTopicCommentCreated ¶ added in v0.2.0
type ForumTopicCommentCreated struct { ServerID string `json:"serverId"` ForumTopicComment `json:"forumTopicComment"` }
type ForumTopicCommentDeleted ¶ added in v0.2.0
type ForumTopicCommentDeleted struct { ServerID string `json:"serverId"` ForumTopicComment `json:"forumTopicComment"` }
type ForumTopicCommentUpdated ¶ added in v0.2.0
type ForumTopicCommentUpdated struct { ServerID string `json:"serverId"` ForumTopicComment `json:"forumTopicComment"` }
type ForumTopicCreated ¶ added in v0.2.0
type ForumTopicCreated struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type ForumTopicDeleted ¶ added in v0.2.0
type ForumTopicDeleted struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type ForumTopicLocked ¶ added in v0.2.0
type ForumTopicLocked struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type ForumTopicObject ¶ added in v0.2.0
type ForumTopicPinned ¶ added in v0.2.0
type ForumTopicPinned struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type ForumTopicReactionCreated ¶ added in v0.2.0
type ForumTopicReactionDeleted ¶ added in v0.2.0
type ForumTopicSummary ¶ added in v0.1.4
type ForumTopicSummary struct { // The ID of the forum topic ID int `json:"id"` // The ID of the server ServerID string `json:"serverId"` // The ID of the channel ChannelID string `json:"channelId"` // The title of the forum topic (min length 1; max length 500) Title string `json:"title"` // The ISO 8601 timestamp that the forum topic was created at CreatedAt string `json:"createdAt"` // The ID of the user who created this forum topic // (Note: If this event has createdByWebhookId present, this field will still be populated, // but can be ignored. In this case, the value of this field will always be Ann6LewA) CreatedBy string `json:"createdBy"` // The ID of the webhook who created this forum topic, if it was created by a webhook CreatedByWebhookID string `json:"createdByWebhookId,omitempty"` // The ISO 8601 timestamp that the forum topic was updated at, if relevant UpdatedAt string `json:"updatedAt,omitempty"` // The ISO 8601 timestamp that the forum topic was bumped at. // This timestamp is updated whenever there is any activity on the posts within the forum topic. BumpedAt string `json:"bumpedAt,omitempty"` // (default false) IsPinned bool `json:"isPinned,omitempty"` // (default false) IsLocked bool `json:"isLocked,omitempty"` }
type ForumTopicUnlocked ¶ added in v0.2.0
type ForumTopicUnlocked struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type ForumTopicUnpinned ¶ added in v0.2.0
type ForumTopicUnpinned struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type ForumTopicUpdated ¶ added in v0.2.0
type ForumTopicUpdated struct { ServerID string `json:"serverId"` ForumTopic `json:"forumTopic"` }
type GetAnnouncementParams ¶ added in v0.5.2
type GetEventsOptions ¶ added in v0.2.0
type GetMessageResponse ¶
type GetMessageResponse struct {
Message ChatMessage `json:"message"`
}
type GetMessagesObject ¶
type ListItem ¶ added in v0.3.0
type ListItem struct { ID string `json:"id"` ServerID string `json:"serverId"` ChannelID string `json:"channelId"` Messsage string `json:"message"` Mentions `json:"mentions,omitempty"` CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` CreatedByWebhookID string `json:"createdByWebhookId,omitempty"` UpdatedAt string `json:"updatedAt",omitempty` UpdatedBy string `json:"updatedBy,omitempty"` ParentListItemID string `json:"parentListItemId,omitempty"` CompletedAt string `json:"completedAt,omitempty"` CompletedBy string `json:"completedBy,omitempty"` Note struct { CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` UpdatedAt string `json:"updatedAt,omitempty"` UpdatedBy string `json:"updatedBy"` Mentions `json:"mentions,omitempty"` Content string `json:"content"` } `json:"note"` }
type ListItemSummary ¶ added in v0.3.0
type ListItemSummary struct { ID string `json:"id"` ServerID string `json:"serverId"` ChannelID string `json:"channelId"` Messsage string `json:"message"` Mentions `json:"mentions,omitempty"` CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` CreatedByWebhookID string `json:"createdByWebhookId,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` ParentListItemID string `json:"parentListItemId,omitempty"` CompletedAt string `json:"completedAt,omitempty"` CompletedBy string `json:"completedBy,omitempty"` Note struct { CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` UpdatedAt string `json:"updatedAt,omitempty"` UpdatedBy string `json:"updatedBy"` } `json:"note,omitempty"` }
type ListObject ¶ added in v0.3.0
type ListService ¶ added in v0.3.0
type ListService interface { CreateListItem(channelID string, listObject ListObject) (*ListItem, error) GetChannelListItems(channelID string) ([]ListItemSummary, error) GetListItem(channelID, listItemID string) (*ListItem, error) UpdateListItem(channelID, listItemID string, listObject ListObject) (*ListItem, error) DeleteListItem(channelID, listItemID string) error CompleteListItem(channelID, listItemID string) error UncompleteListItem(channelID, listItemID string) error }
type MembersService ¶
type MembersService interface { UpdateMemberNickname(userId string, nickname string) (*NicknameResponse, error) DeleteMemberNickname(userId string) error GetServerMember(serverId string, userId string) (*ServerMember, error) KickMember(userId string) error BanMember(userId string, reason string) (*ServerMemberBan, error) IsMemberBanned(userId string) (*ServerMemberBan, error) UnbanMember(userId string) error GetServerMembers() (*[]ServerMemberSummary, error) }
type Mentions ¶ added in v0.1.4
type Mentions struct { // Info on mentioned users (min items 1) Users []MentionsUser `json:"users,omitempty"` // Info on mentioned channels (min items 1) Channels []MentionsChannel `json:"channels,omitempty"` // Info on mentioned roles (min items 1) Roles []MentionsRole `json:"roles,omitempty"` // If @everyone was mentioned Everyone bool `json:"everyone,omitempty"` // If @here was mentioned Here bool `json:"here,omitempty"` }
type MentionsChannel ¶ added in v0.1.4
type MentionsChannel struct { // The ID of the channel ID string `json:"id"` }
type MentionsRole ¶ added in v0.1.4
type MentionsRole struct { // The ID of the role ID int `json:"id"` }
type MentionsUser ¶ added in v0.1.4
type MentionsUser struct { // The ID of the user ID string `json:"id"` }
type MessageObject ¶
type MessageObject struct { // If set, this message will only be seen by those mentioned or replied to IsPrivate bool `json:"isPrivate,omitempty"` // If set, this message will not notify any mentioned users or roles (default false) IsSilent bool `json:"isSilent,omitempty"` // Message IDs to reply to (min items 1; max items 5) ReplyMessageIds []string `json:"replyMessageIds,omitempty"` // The content of the message (min length 1; max length 4000) Content string `json:"content,omitempty"` // At this time, only one embed is supported per message, and attachments are not supported. // If you need to send more than one embed or upload attachments, consider creating the // message via a webhook. (min items 1; max items 1) Embeds []ChatEmbed `json:"embeds,omitempty"` }
type MessageResponse ¶
type MessageResponse struct {
Message ChatMessage `json:"message"`
}
type NewChannelObject ¶ added in v0.1.3
type NewChannelObject struct { Name string `json:"name"` Topic string `json:"topic,omitempty"` IsPublic bool `json:"isPublic,omitempty"` Type string `json:"type"` ServerID string `json:"serverId,omitempty"` GroupID string `json:"groupId,omitempty"` CategoryID int `json:"categoryId,omitempty"` ParentID string `json:"parentId,omitempty"` MessageID string `json:"messageId,omitempty"` }
type NicknameResponse ¶
type NicknameResponse struct {
Nickname string `json:"nickname"`
}
type RawEvent ¶ added in v0.1.2
type RawEvent struct { T string `json:"t"` S string `json:"s"` Data json.RawMessage `json:"d"` }
type RawEvent2 ¶ added in v1.0.1
type RawEvent2 struct { OP int `json:"op"` T string `json:"t"` S string `json:"s"` Data json.RawMessage `json:"d"` }
type ReactionService ¶ added in v0.3.0
type ReactionService interface { AddReactionEmote(channelId string, contentId string, emoteId int) error DeleteReactionEmote(channelId string, contentId string, emoteId int) error AddTopicReactionEmote(channelId string, topicId int, emoteId int) error DeleteTopicReactionEmote(channelId string, topicId int, emoteId int) error }
type RoleService ¶ added in v0.1.1
type Server ¶ added in v0.1.4
type Server struct { ID string `json:"id"` OwnerID string `json:"ownerid"` Type string `json:"type,omitempty"` Name string `json:"name"` URL string `json:"url,omitempty"` About string `json:"about,omitempty"` Avatar string `json:"avatar,omitempty"` Banner string `json:"banner,omitempty"` Timezone string `json:"timezone,omitempty"` IsVerified bool `json:"isVerified,omitempty"` // The channel ID of the default channel of the server. // This channel is defined as the first chat or voice channel in the left sidebar of a server in our UI. // This channel is useful for sending welcome messages, // though note that a bot may not have permissions to interact with this channel depending on how the server is configured. DefaultChannelId string `json:"defaultChannelId,omitempty"` CreatedAt string `json:"createdAt"` }
type ServerChannel ¶ added in v0.1.3
type ServerChannel struct { ID string `json:"id"` // The type of channel. This will determine what routes to use for creating content in a channel. // For example, if this "chat", then one must use the routes for creating channel messages Type string `json:"type"` Name string `json:"name"` // The topic of the channel. Not applicable to threads (min length 1; max length 512) Topic string `json:"topic,omitempty"` CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` UpdatedAt string `json:"updatedAt,omitempty"` ServerID string `json:"serverId"` // ID of the root channel or thread in the channel hierarchy. // Only applicable to "chat", "voice", and "stream" channels and indicates that this channel is a thread, if present RootID string `json:"rootId,omitempty"` // ID of the immediate parent channel or thread in the channel hierarchy. // Only applicable to "chat", "voice", and "stream" channels and indicates that this channel is a thread, if present ParentID string `json:"parentId,omitempty"` // The ID of the message that this channel was created off of. // Only applicable to "chat", "voice", and "stream" channels and indicates that this channel is a thread, if present MessageID string `json:"messageId,omitempty"` // The category that the channel exists in. Only relevant for server channels CategoryID int `json:"categoryId,omitempty"` GroupID string `json:"groupId"` IsPublic bool `json:"isPublic,omitempty"` ArchivedBy string `json:"archivedBy,omitempty"` ArchivedAt string `json:"archivedAt,omitempty"` }
type ServerChannelCreated ¶ added in v0.1.3
type ServerChannelCreated struct { ServerID string `json:"serverId"` Channel ServerChannel `json:"channel"` }
type ServerChannelDeleted ¶ added in v0.2.0
type ServerChannelDeleted struct { ServerID string `json:"serverId"` Channel ServerChannel `json:"channel"` }
type ServerChannelResponse ¶ added in v0.1.3
type ServerChannelResponse struct {
Channel ServerChannel `json:"channel"`
}
type ServerChannelUpdated ¶ added in v0.1.4
type ServerChannelUpdated struct { ServerID string `json:"serverId"` Channel ServerChannel `json:"channel"` }
type ServerMember ¶
type ServerMember struct { User User `json:"user"` // (must have unique items true) RoleIds []int `json:"roleIds"` Nickname string `json:"nickname,omitempty"` // The ISO 8601 timestamp that the member was created at JoinedAt string `json:"joinedAt"` // (default false) IsOwner bool `json:"isOwner,omitempty"` }
type ServerMemberBan ¶
type ServerMemberBan struct { User UserSummary `json:"user"` // The reason for the ban as submitted by the banner Reason string `json:"reason,omitempty"` // The ID of the user who created this server member ban CreatedBy string `json:"createdBy"` // The ISO 8601 timestamp that the server member ban was created at CreatedAt string `json:"createdAt"` }
type ServerMemberBanned ¶ added in v0.1.4
type ServerMemberBanned struct { // The ID of the server ServerID string `json:"serverId"` ServerMemberBan `json:"serverMemberBan"` }
type ServerMemberJoined ¶ added in v0.1.4
type ServerMemberJoined struct { // The ID of the server ServerID string `json:"serverId"` Member ServerMember `json:"member"` }
type ServerMemberPermissions ¶ added in v0.5.2
type ServerMemberPermissions struct {
Permissions []string `json:"permissions"`
}
type ServerMemberRemoved ¶ added in v0.1.4
type ServerMemberRemoved struct { // The ID of the server ServerID string `json:"serverId"` // The ID of the user UserID string `json:"userId"` // If this member leaving was the result of a kick IsKick bool `json:"isKick,omitempty"` // If this member leaving was the result of a ban IsBan bool `json:"isBan,omitempty"` }
type ServerMemberResponse ¶
type ServerMemberResponse struct {
Member ServerMember `json:"member"`
}
type ServerMemberSummary ¶
type ServerMemberSummary struct { User UserSummary `json:"user"` // (must have unique items true) RoleIds []int `json:"roleIds"` }
type ServerMemberUnbanned ¶ added in v0.1.4
type ServerMemberUnbanned struct { // The ID of the server ServerID string `json:"serverId"` ServerMemberBan `json:"serverMemberBan"` }
type ServerMemberUpdated ¶ added in v0.1.4
type ServerResponse ¶ added in v0.1.4
type ServerResponse struct {
Server `json:"server"`
}
type ServerRolesUpdated ¶ added in v0.2.0
type ServerService ¶ added in v0.1.4
type ServerWebhookCreated ¶ added in v0.2.0
type ServerWebhookUpdated ¶ added in v0.2.0
type ServerXPService ¶ added in v0.4.0
type SocialLink ¶ added in v0.4.3
type SocialResponse ¶ added in v0.4.3
type SocialResponse struct {
SocialLink `json:"socialLink"`
}
type SocialsService ¶ added in v0.4.3
type SocialsService interface {
GetMemberSocialLinks(serverID string, userID string, socialType string) (*SocialLink, error)
}
type UpdateChannelObject ¶ added in v0.1.4
type UpdateTopicObject ¶ added in v0.2.0
type User ¶
type User struct { // The ID of the user Id string `json:"id"` // The type of user. If this property is absent, it can assumed to be of type user Type string `json:"type,omitempty"` Name string `json:"name"` // The avatar image associated with the user Avatar string `json:"avatar,omitempty"` // The banner image associated with the user Banner string `json:"banner,omitempty"` // The ISO 8601 timestamp that the user was created at CreatedAt string `json:"createdAt"` Status UserStatus `json:"status,omitempty"` }
type UserResponse ¶ added in v0.5.3
type UserResponse struct {
User `json:"user"`
}
type UserService ¶ added in v0.5.3
type UserStatus ¶ added in v0.5.3
type UserStatusUpdate ¶ added in v0.5.3
type UserSummary ¶
type UserSummary struct { // The ID of the user Id string `json:"id"` // The type of user. If this property is absent, it can assumed to be of type user Type string `json:"type,omitempty"` Name string `json:"name"` // The avatar image associated with the user Avatar string `json:"avatar,omitempty"` }
type WebhookObject ¶ added in v0.3.0
type WebhookService ¶ added in v0.3.0
type WebhookService interface { CreateWebhook(serverId string, webhookObject *WebhookObject) (*Webhook, error) GetWebhooks(serverId string) ([]Webhook, error) GetWebhook(serverId string, webhookId string) (*Webhook, error) UpdateWebhook(serverId string, webhookId string, webhookObject *WebhookObject) (*Webhook, error) DeleteWebhook(serverId string, webhookId string) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.