disgo

package module
v0.0.0-...-70adb54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 20 Imported by: 0

README

DisGo Build Status Go Report Card GoDoc

This was a learning project for me that I used to teach myself Go, while it contains most of the functions needed to make a simple bot I never bothered to fix some of the websocket recovery issues. Instead, I urge you to look at https://github.com/bwmarrin/discordgo, as I have begun contributing there. This library has a very similar API but without some of the convenience methods, but is stable.

Documentation

Index

Constants

View Source
const (
	PermissionCreateInstantInvite = 0x00000001
	PermissionKickMembers         = 0x00000002
	PermissionBanMembers          = 0x00000004
	PermissionAdministrator       = 0x00000008
	PermissionManageChannels      = 0x00000010
	PermissionManageGuild         = 0x00000020
	PermissionAddReactions        = 0x00000040
	PermissionViewAuditLog        = 0x00000080
	PermissionReadMessages        = 0x00000400
	PermissionSendMessages        = 0x00000800
	PermissionSendTTSMessages     = 0x00001000
	PermissionManageMessages      = 0x00002000
	PermissionEmbedLinks          = 0x00004000
	PermissionAttachFiles         = 0x00008000
	PermissionReadMessageHistory  = 0x00010000
	PermissionMentionEveryone     = 0x00020000
	PermissionUseExternalEmojis   = 0x00040000
	PermissionConnect             = 0x00100000
	PermissionSpeak               = 0x00200000
	PermissionMuteMembers         = 0x00400000
	PermissionDeafenMembers       = 0x00800000
	PermissionMoveMembers         = 0x01000000
	PermissionUseVAD              = 0x02000000
	PermissionChangeNickname      = 0x04000000
	PermissionManageNicknames     = 0x08000000
	PermissionManageRoles         = 0x10000000
	PermissionManageWebhooks      = 0x20000000
	PermissionManageEmojis        = 0x40000000
)

Variables

View Source
var (
	BaseUrl = "https://discordapp.com/api/v" + gatewayVersion

	EndPointGateway      = makeEndPoint("/gateway")
	EndPointBotGateway   = makeEndPoint("/gateway/bot")
	EndPointVoiceRegions = makeEndPoint("/voice/regions")

	EndPointChannel            = makeEndPoint("/channels/:channel_id")
	EndPointMessages           = makeEndPoint("/channels/:channel_id/messages")
	EndPointMessage            = makeEndPoint("/channels/:channel_id/messages/:message_id")
	EndPointMessageBulkDelete  = makeEndPoint("/channels/:channel_id/messages/bulk-delete")
	EndPointReactions          = makeEndPoint("/channels/:channel_id/messages/:mesasge_id/reactions")
	EndPointReaction           = makeEndPoint("/channels/:channel_id/messages/:mesasge_id/reactions/%%s/:user_id")
	EndPointOwnReaction        = makeEndPoint("/channels/:channel_id/messages/:message_id/reactions/%%s/@me")
	EndPointChannelPermissions = makeEndPoint("/channels/:channel_id/permissions/:overwrite_id")
	EndPointChannelInvites     = makeEndPoint("/channels/:channel_id/invites")
	EndPointChannelTyping      = makeEndPoint("/channels/:channel_id/typing")
	EndPointChannelPins        = makeEndPoint("/channels/:channel_id/pins")
	EndPointChannelPin         = makeEndPoint("/channels/:channel_id/pins/:message_id")
	EndPointChannelRecipient   = makeEndPoint("/channels/:channel_id/recipients/:user_id")

	EndPointGuilds               = makeEndPoint("/guilds")
	EndPointGuild                = makeEndPoint("/guilds/:guild_id")
	EndPointGuildChannels        = makeEndPoint("/guilds/:guild_id/channels")
	EndPointGuildMembers         = makeEndPoint("/guilds/:guild_id/members")
	EndPointGuildMember          = makeEndPoint("/guilds/:guild_id/members/:user_id")
	EndPointGuildOwnNick         = makeEndPoint("/guilds/:guild_id/members/@me/nick")
	EndPointGuildMemberRoles     = makeEndPoint("/guilds/:guild_id/members/:user_id/roles/:role_id")
	EndPointGuildBans            = makeEndPoint("/guilds/:guild_id/bans")
	EndPointGuildMemberBan       = makeEndPoint("/guilds/:guild_id/bans/:user_id")
	EndPointGuildRoles           = makeEndPoint("/guilds/:guild_id/roles")
	EndPointGuildRole            = makeEndPoint("/guilds/:guild_id/roles/:role_id")
	EndPointGuildPrune           = makeEndPoint("/guilds/:guild_id/prune")
	EndPointGuildRegions         = makeEndPoint("/guilds/:guild_id/regions")
	EndPointGuildInvites         = makeEndPoint("/guilds/:guild_id/invites")
	EndPointGuildIntegrations    = makeEndPoint("/guilds/:guild_id/integrations")
	EndPointGuildIntegration     = makeEndPoint("/guilds/:guild_id/integrations/:integration_id")
	EndPointGuildIntegrationSync = makeEndPoint("/guilds/:guild_id/integrations/:integration_id/sync")
	EndPointGuildEmbed           = makeEndPoint("/guilds/:guild_id/embed")

	EndPointOwnUser    = makeEndPoint("/users/@me")
	EndPointUser       = makeEndPoint("/users/:user_id")
	EndPointUserAvatar = BaseUrl + "/users/%d/avatars/%s.jpg"
	EndPointOwnGuilds  = makeEndPoint("/users/@me/guilds")
	EndPointOwnGuild   = makeEndPoint("/users/@me/guilds/:guild_id")
	EndPointDMChannels = makeEndPoint("/users/@me/channels")
)

Functions

func SnowflakeInSlice

func SnowflakeInSlice(a Snowflake, list []Snowflake) bool

Types

type Attachment

type Attachment struct {
	// contains filtered or unexported fields
}

Attachment is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Attachment) Filename

func (s *Attachment) Filename() string

Filename is used to export the Filename from this struct.

func (*Attachment) Height

func (s *Attachment) Height() int

Height is used to export the Height from this struct.

func (*Attachment) ID

func (s *Attachment) ID() Snowflake

ID is used to export the ID from this struct.

func (*Attachment) MarshalJSON

func (s *Attachment) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Attachment) ProxyURL

func (s *Attachment) ProxyURL() string

ProxyURL is used to export the ProxyURL from this struct.

func (*Attachment) Size

func (s *Attachment) Size() int

Size is used to export the Size from this struct.

func (*Attachment) URL

func (s *Attachment) URL() string

URL is used to export the URL from this struct.

func (*Attachment) UnmarshalJSON

func (s *Attachment) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*Attachment) Width

func (s *Attachment) Width() int

Width is used to export the Width from this struct.

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

Channel is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Channel) Bitrate

func (s *Channel) Bitrate() int

Bitrate is used to export the Bitrate from this struct.

func (*Channel) Delete

func (s *Channel) Delete() error

func (*Channel) Guild

func (s *Channel) Guild() *Guild

func (*Channel) GuildID

func (s *Channel) GuildID() Snowflake

GuildID is used to export the GuildID from this struct.

func (*Channel) ID

func (s *Channel) ID() Snowflake

ID is used to export the ID from this struct.

func (*Channel) LastMessageID

func (s *Channel) LastMessageID() Snowflake

LastMessageID is used to export the LastMessageID from this struct.

func (*Channel) MarshalJSON

func (s *Channel) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Channel) Mention

func (s *Channel) Mention() string

func (*Channel) Name

func (s *Channel) Name() string

Name is used to export the Name from this struct.

func (*Channel) PermissionOverwrites

func (s *Channel) PermissionOverwrites() []Overwrite

PermissionOverwrites is used to export the PermissionOverwrites from this struct.

func (*Channel) Position

func (s *Channel) Position() int

Position is used to export the Position from this struct.

func (*Channel) Recipients

func (s *Channel) Recipients() []*User

Recipients is used to export the Recipients from this struct.

func (*Channel) Topic

func (s *Channel) Topic() string

Topic is used to export the Topic from this struct.

func (*Channel) Type

func (s *Channel) Type() ChannelType

Type is used to export the Type from this struct.

func (*Channel) UnmarshalJSON

func (s *Channel) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*Channel) UserLimit

func (s *Channel) UserLimit() int

UserLimit is used to export the UserLimit from this struct.

type ChannelBuilder

type ChannelBuilder struct {
	Name                 string      `json:"name"`
	Type                 string      `json:"type,omitempty"`
	Bitrate              int         `json:"bitrate,omitempty"`
	UserLimit            int         `json:"user_limit,omitempty"`
	PermissionOverwrites []Overwrite `json:"permission_overwrites"`
	// contains filtered or unexported fields
}

func (*ChannelBuilder) AddMemberOverwrite

func (b *ChannelBuilder) AddMemberOverwrite(id Snowflake, allow, deny int) *ChannelBuilder

func (*ChannelBuilder) AddRoleOverwrite

func (b *ChannelBuilder) AddRoleOverwrite(id Snowflake, allow, deny int) *ChannelBuilder

func (*ChannelBuilder) Create

func (b *ChannelBuilder) Create() (*Channel, error)

type ChannelCreateEvent

type ChannelCreateEvent struct {
	*Channel
}

type ChannelDeleteEvent

type ChannelDeleteEvent struct {
	*Channel
}

type ChannelType

type ChannelType int
const (
	ChannelTypeGuildText ChannelType = iota
	ChannelTypeDirectMessage
	ChannelTypeGuildVoice
	ChannelTypeGroupDirectMessage
	ChannelTypeGuildCategory
)

type ChannelUpdateEvent

type ChannelUpdateEvent struct {
	*Channel
}

type DiscordTime

type DiscordTime struct {
	*time.Time
}

func (*DiscordTime) MarshalJSON

func (t *DiscordTime) MarshalJSON() ([]byte, error)

func (*DiscordTime) UnmarshalJSON

func (t *DiscordTime) UnmarshalJSON(data []byte) error

type Embed

type Embed struct {
	Title       string         `json:"title,omitempty"`
	Type        string         `json:"type,omitempty"`
	Description string         `json:"description,omitempty"`
	URL         string         `json:"url,omitempty"`
	Timestamp   DiscordTime    `json:"timestamp,omitempty"`
	Color       int            `json:"color,omitempty"`
	Footer      EmbedFooter    `json:"footer,omitempty"`
	Image       EmbedImage     `json:"image,omitempty"`
	Thumbnail   EmbedThumbnail `json:"thumbnail,omitempty"`
	Video       EmbedVideo     `json:"video,omitempty"`
	Provider    EmbedProvider  `json:"provider,omitempty"`
	Author      EmbedAuthor    `json:"author,omitempty"`
	Fields      []EmbedField   `json:"fields,omitempty"`
}

type EmbedAuthor

type EmbedAuthor struct {
	Name         string `json:"name,omitempty"`
	URL          string `json:"url,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

type EmbedField

type EmbedField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline"`
}

type EmbedFooter

type EmbedFooter struct {
	Text         string `json:"text,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

type EmbedImage

type EmbedImage struct {
	URL      string `json:"url"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Height   int    `json:"height,omitempty"`
	Width    int    `json:"width,omitempty"`
}

type EmbedProvider

type EmbedProvider struct {
	Name string `json:"name,omitempty"`
	URL  string `json:"url,omitempty"`
}

type EmbedThumbnail

type EmbedThumbnail struct {
	URL      string `json:"url"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Height   int    `json:"height,omitempty"`
	Width    int    `json:"width,omitempty"`
}

type EmbedVideo

type EmbedVideo struct {
	URL    string `json:"url"`
	Height int    `json:"height,omitempty"`
	Width  int    `json:"width,omitempty"`
}

type Emoji

type Emoji struct {
	// contains filtered or unexported fields
}

Emoji is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Emoji) ID

func (s *Emoji) ID() Snowflake

ID is used to export the ID from this struct.

func (*Emoji) Managed

func (s *Emoji) Managed() bool

Managed is used to export the Managed from this struct.

func (*Emoji) MarshalJSON

func (s *Emoji) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Emoji) Name

func (s *Emoji) Name() string

Name is used to export the Name from this struct.

func (*Emoji) RequireColons

func (s *Emoji) RequireColons() bool

RequireColons is used to export the RequireColons from this struct.

func (*Emoji) Roles

func (s *Emoji) Roles() []Snowflake

Roles is used to export the Roles from this struct.

func (*Emoji) UnmarshalJSON

func (s *Emoji) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

type EndPoint

type EndPoint struct {
	Url string
	// contains filtered or unexported fields
}

type Event

type Event interface {
	// contains filtered or unexported methods
}

type Game

type Game struct {
	// contains filtered or unexported fields
}

Game is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Game) MarshalJSON

func (s *Game) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Game) Name

func (s *Game) Name() string

Name is used to export the Name from this struct.

func (*Game) Type

func (s *Game) Type() int

Type is used to export the Type from this struct.

func (*Game) URL

func (s *Game) URL() string

URL is used to export the URL from this struct.

func (*Game) UnmarshalJSON

func (s *Game) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

type GetMessagesMode

type GetMessagesMode int
const (
	GetLastMessages GetMessagesMode = iota
	GetMessagesAround
	GetMessagesBefore
	GetMessagesAfter
)

type Guild

type Guild struct {
	// contains filtered or unexported fields
}

Guild is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Guild) AFKChannelID

func (s *Guild) AFKChannelID() Snowflake

AFKChannelID is used to export the AFKChannelID from this struct.

func (*Guild) AFKTimeout

func (s *Guild) AFKTimeout() int

AFKTimeout is used to export the AFKTimeout from this struct.

func (*Guild) BanUser

func (s *Guild) BanUser(userID Snowflake, deleteMessageDays int) error

func (*Guild) BuildChannel

func (s *Guild) BuildChannel(name string) *ChannelBuilder

func (*Guild) Channels

func (s *Guild) Channels() []*Channel

Channels is used to export the Channels from this struct.

func (*Guild) DefaultMessageNotifications

func (s *Guild) DefaultMessageNotifications() int

DefaultMessageNotifications is used to export the DefaultMessageNotifications from this struct.

func (*Guild) EmbedChannelID

func (s *Guild) EmbedChannelID() Snowflake

EmbedChannelID is used to export the EmbedChannelID from this struct.

func (*Guild) EmbedEnabled

func (s *Guild) EmbedEnabled() bool

EmbedEnabled is used to export the EmbedEnabled from this struct.

func (*Guild) Emojis

func (s *Guild) Emojis() []Emoji

Emojis is used to export the Emojis from this struct.

func (*Guild) Features

func (s *Guild) Features() []string

Features is used to export the Features from this struct.

func (*Guild) GetRoleUsers

func (s *Guild) GetRoleUsers(roleID Snowflake) []*User

func (*Guild) GetUserColor

func (s *Guild) GetUserColor(userID Snowflake) (int, bool)

func (*Guild) GetUserMembership

func (s *Guild) GetUserMembership(userID Snowflake) (*GuildMember, bool)

func (*Guild) GetUserRoles

func (s *Guild) GetUserRoles(userID Snowflake) ([]Snowflake, bool)

func (*Guild) ID

func (s *Guild) ID() Snowflake

ID is used to export the ID from this struct.

func (*Guild) IconHash

func (s *Guild) IconHash() string

IconHash is used to export the IconHash from this struct.

func (*Guild) JoinedAt

func (s *Guild) JoinedAt() DiscordTime

JoinedAt is used to export the JoinedAt from this struct.

func (*Guild) KickUser

func (s *Guild) KickUser(userID Snowflake) error

func (*Guild) Large

func (s *Guild) Large() bool

Large is used to export the Large from this struct.

func (*Guild) MFALevel

func (s *Guild) MFALevel() int

MFALevel is used to export the MFALevel from this struct.

func (*Guild) MarshalJSON

func (s *Guild) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Guild) MemberCount

func (s *Guild) MemberCount() int

MemberCount is used to export the MemberCount from this struct.

func (*Guild) Members

func (s *Guild) Members() []*GuildMember

Members is used to export the Members from this struct.

func (*Guild) Name

func (s *Guild) Name() string

Name is used to export the Name from this struct.

func (*Guild) OwnerID

func (s *Guild) OwnerID() Snowflake

OwnerID is used to export the OwnerID from this struct.

func (*Guild) Presences

func (s *Guild) Presences() []Presence

Presences is used to export the Presences from this struct.

func (*Guild) Region

func (s *Guild) Region() string

Region is used to export the Region from this struct.

func (*Guild) Role

func (s *Guild) Role(id Snowflake) (*Role, bool)

func (*Guild) Roles

func (s *Guild) Roles() []*Role

Roles is used to export the Roles from this struct.

func (*Guild) SplashHash

func (s *Guild) SplashHash() string

SplashHash is used to export the SplashHash from this struct.

func (*Guild) Unavailable

func (s *Guild) Unavailable() bool

Unavailable is used to export the Unavailable from this struct.

func (*Guild) UnbanUser

func (s *Guild) UnbanUser(userID Snowflake) error

func (*Guild) UnmarshalJSON

func (s *Guild) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*Guild) VerificationLevel

func (s *Guild) VerificationLevel() int

VerificationLevel is used to export the VerificationLevel from this struct.

func (*Guild) VoiceStates

func (s *Guild) VoiceStates() []json.RawMessage

VoiceStates is used to export the VoiceStates from this struct.

type GuildBanAddEvent

type GuildBanAddEvent struct {
	*User
	GuildID Snowflake `json:"guild_id"`
}

func (*GuildBanAddEvent) UnmarshalJSON

func (e *GuildBanAddEvent) UnmarshalJSON(b []byte) error

type GuildBanRemoveEvent

type GuildBanRemoveEvent struct {
	*User
	GuildID Snowflake `json:"guild_id"`
}

func (*GuildBanRemoveEvent) UnmarshalJSON

func (e *GuildBanRemoveEvent) UnmarshalJSON(b []byte) error

type GuildCreateEvent

type GuildCreateEvent struct {
	*Guild
}

type GuildDeleteEvent

type GuildDeleteEvent struct {
	*Guild
}

type GuildEmojisUpdateEvent

type GuildEmojisUpdateEvent struct {
	GuildID Snowflake `json:"guild_id"`
	Emojis  []Emoji   `json:"emojis"`
}

type GuildIntegrationsUpdateEvent

type GuildIntegrationsUpdateEvent struct {
	GuildID Snowflake `json:"guild_id"`
}

type GuildMember

type GuildMember struct {
	// contains filtered or unexported fields
}

GuildMember is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*GuildMember) Deaf

func (s *GuildMember) Deaf() bool

Deaf is used to export the Deaf from this struct.

func (*GuildMember) JoinedAt

func (s *GuildMember) JoinedAt() DiscordTime

JoinedAt is used to export the JoinedAt from this struct.

func (*GuildMember) MarshalJSON

func (s *GuildMember) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*GuildMember) Mute

func (s *GuildMember) Mute() bool

Mute is used to export the Mute from this struct.

func (*GuildMember) Nick

func (s *GuildMember) Nick() string

Nick is used to export the Nick from this struct.

func (*GuildMember) RolesIDs

func (s *GuildMember) RolesIDs() []Snowflake

RolesIDs is used to export the RolesIDs from this struct.

func (*GuildMember) UnmarshalJSON

func (s *GuildMember) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*GuildMember) User

func (s *GuildMember) User() *User

User is used to export the User from this struct.

type GuildMemberAddEvent

type GuildMemberAddEvent struct {
	*GuildMember
	GuildID Snowflake `json:"guild_id"`
}

func (*GuildMemberAddEvent) UnmarshalJSON

func (e *GuildMemberAddEvent) UnmarshalJSON(b []byte) error

type GuildMemberRemoveEvent

type GuildMemberRemoveEvent struct {
	GuildID Snowflake `json:"guild_id"`
	User    *User     `json:"user"`
}

type GuildMemberUpdateEvent

type GuildMemberUpdateEvent struct {
	GuildID Snowflake   `json:"guild_id"`
	Roles   []Snowflake `json:"roles"`
	User    *User       `json:"user"`
	Nick    string      `json:"nick"`
}

type GuildMembersChunkEvent

type GuildMembersChunkEvent struct {
	GuildID Snowflake     `json:"guild_id"`
	Members []GuildMember `json:"members"`
}

type GuildRoleCreateEvent

type GuildRoleCreateEvent struct {
	GuildID Snowflake `json:"guild_id"`
	Role    *Role     `json:"role"`
}

type GuildRoleDeleteEvent

type GuildRoleDeleteEvent struct {
	GuildID Snowflake `json:"guild_id"`
	RoleID  Snowflake `json:"role_id"`
}

type GuildRoleUpdateEvent

type GuildRoleUpdateEvent struct {
	GuildID Snowflake `json:"guild_id"`
	Role    *Role     `json:"role"`
}

type GuildUpdateEvent

type GuildUpdateEvent struct {
	*Guild
}

type IDObject

type IDObject struct {
	Id Snowflake `json:"id"`
}

func (*IDObject) ID

func (o *IDObject) ID() Snowflake

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Message) AddReaction

func (s *Message) AddReaction(emoji string) error

func (*Message) Attachments

func (s *Message) Attachments() []Attachment

Attachments is used to export the Attachments from this struct.

func (*Message) Author

func (s *Message) Author() *User

Author is used to export the Author from this struct.

func (*Message) Channel

func (s *Message) Channel() *Channel

func (*Message) ChannelID

func (s *Message) ChannelID() Snowflake

ChannelID is used to export the ChannelID from this struct.

func (*Message) Content

func (s *Message) Content() string

Content is used to export the Content from this struct.

func (*Message) Delete

func (s *Message) Delete() error

func (*Message) DeleteAllReactions

func (s *Message) DeleteAllReactions() error

func (*Message) DeleteOwnReaction

func (s *Message) DeleteOwnReaction(emoji string) error

func (*Message) DeleteReaction

func (s *Message) DeleteReaction(userID Snowflake, emoji string) error

func (*Message) Edit

func (s *Message) Edit(content string) (err error)

func (*Message) EditEmbed

func (s *Message) EditEmbed(embed Embed) (err error)

func (*Message) EditEmbeddedMessage

func (s *Message) EditEmbeddedMessage(content string, embed Embed) (err error)

func (*Message) EditedTimestamp

func (s *Message) EditedTimestamp() DiscordTime

EditedTimestamp is used to export the EditedTimestamp from this struct.

func (*Message) Embeds

func (s *Message) Embeds() []Embed

Embeds is used to export the Embeds from this struct.

func (*Message) ID

func (s *Message) ID() Snowflake

ID is used to export the ID from this struct.

func (*Message) MarshalJSON

func (s *Message) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Message) MentionEveryone

func (s *Message) MentionEveryone() bool

MentionEveryone is used to export the MentionEveryone from this struct.

func (*Message) MentionRoles

func (s *Message) MentionRoles() []Snowflake

MentionRoles is used to export the MentionRoles from this struct.

func (*Message) Mentions

func (s *Message) Mentions() []*User

Mentions is used to export the Mentions from this struct.

func (*Message) NOnce

func (s *Message) NOnce() Snowflake

NOnce is used to export the NOnce from this struct.

func (*Message) Pin

func (s *Message) Pin() error

func (*Message) Pinned

func (s *Message) Pinned() bool

Pinned is used to export the Pinned from this struct.

func (*Message) Reactions

func (s *Message) Reactions() []Reaction

Reactions is used to export the Reactions from this struct.

func (*Message) TTS

func (s *Message) TTS() bool

TTS is used to export the TTS from this struct.

func (*Message) Timestamp

func (s *Message) Timestamp() DiscordTime

Timestamp is used to export the Timestamp from this struct.

func (*Message) Type

func (s *Message) Type() MessageType

Type is used to export the Type from this struct.

func (*Message) UnmarshalJSON

func (s *Message) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*Message) WebhookID

func (s *Message) WebhookID() string

WebhookID is used to export the WebhookID from this struct.

type MessageCreateEvent

type MessageCreateEvent struct {
	*Message
}

func (*MessageCreateEvent) Channel

func (e *MessageCreateEvent) Channel() *Channel

func (*MessageCreateEvent) Reply

func (e *MessageCreateEvent) Reply(content string) (*Message, error)

type MessageDeleteBulkEvent

type MessageDeleteBulkEvent struct {
	IDs       []Snowflake `json:"ids"`
	ChannelID Snowflake   `json:"channel_id"`
}

type MessageDeleteEvent

type MessageDeleteEvent struct {
	ID        Snowflake `json:"id"`
	ChannelID Snowflake `json:"channel_id"`
}

type MessagePrototype

type MessagePrototype struct {
	Content string `json:"content"`
	TTS     bool   `json:"tts"`
	Embed   *Embed `json:"embed,omitempty"`

	FileName string
	File     io.Reader
}

type MessageReactionAddEvent

type MessageReactionAddEvent struct {
	UserID    Snowflake `json:"user_id"`
	ChannelID Snowflake `json:"channel_id"`
	MessageID Snowflake `json:"message_id"`
	Emoji     *Emoji    `json:"emoji"`
}

type MessageReactionRemoveEvent

type MessageReactionRemoveEvent struct {
	UserID    Snowflake `json:"user_id"`
	ChannelID Snowflake `json:"channel_id"`
	MessageID Snowflake `json:"message_id"`
	Emoji     *Emoji    `json:"emoji"`
}

type MessageType

type MessageType int
const (
	MessageTypeDefault MessageType = iota
	MessageTypeRecipientAdd
	MessageTypeRecipientRemove
	MessageTypeCall
	MessageTypeChannelNameChange
	MessageTypeChannelIconChange
	MessageTypeChannelPinnedMessage
	MessageTypeGuildMemberJoin
)

type MessageUpdateEvent

type MessageUpdateEvent struct {
	*Message
}

type Overwrite

type Overwrite struct {
	ID    Snowflake `json:"id"`
	Type  string    `json:"type"`
	Allow int       `json:"allow"`
	Deny  int       `json:"deny"`
}

type Presence

type Presence struct {
	// contains filtered or unexported fields
}

Presence is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Presence) Game

func (s *Presence) Game() Game

Game is used to export the Game from this struct.

func (*Presence) GuildID

func (s *Presence) GuildID() Snowflake

GuildID is used to export the GuildID from this struct.

func (*Presence) MarshalJSON

func (s *Presence) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Presence) Roles

func (s *Presence) Roles() []Snowflake

Roles is used to export the Roles from this struct.

func (*Presence) Status

func (s *Presence) Status() string

Status is used to export the Status from this struct.

func (*Presence) UnmarshalJSON

func (s *Presence) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*Presence) User

func (s *Presence) User() *User

User is used to export the User from this struct.

type PresenceUpdateEvent

type PresenceUpdateEvent struct {
	*Presence
}

type Reaction

type Reaction struct {
	// contains filtered or unexported fields
}

Reaction is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Reaction) Count

func (s *Reaction) Count() int

Count is used to export the Count from this struct.

func (*Reaction) Emoji

func (s *Reaction) Emoji() *Emoji

Emoji is used to export the Emoji from this struct.

func (*Reaction) MarshalJSON

func (s *Reaction) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Reaction) Me

func (s *Reaction) Me() bool

Me is used to export the Me from this struct.

func (*Reaction) UnmarshalJSON

func (s *Reaction) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

type ReadyEvent

type ReadyEvent struct {
	GatewayVersion int      `json:"v"`
	User           *User    `json:"user"`
	Guilds         []*Guild `json:"guilds"`
	SessionID      string   `json:"session_id"`
	Servers        []string `json:"_trace"`
}

type ResumedEvent

type ResumedEvent struct {
	Servers []string `json:"_trace"`
}

type Role

type Role struct {
	// contains filtered or unexported fields
}

Role is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*Role) Color

func (s *Role) Color() int

Color is used to export the Color from this struct.

func (*Role) Hoist

func (s *Role) Hoist() bool

Hoist is used to export the Hoist from this struct.

func (*Role) ID

func (s *Role) ID() Snowflake

ID is used to export the ID from this struct.

func (*Role) Managed

func (s *Role) Managed() bool

Managed is used to export the Managed from this struct.

func (*Role) MarshalJSON

func (s *Role) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*Role) Mentionable

func (s *Role) Mentionable() bool

Mentionable is used to export the Mentionable from this struct.

func (*Role) Name

func (s *Role) Name() string

Name is used to export the Name from this struct.

func (*Role) Permissions

func (s *Role) Permissions() int

Permissions is used to export the Permissions from this struct.

func (*Role) Position

func (s *Role) Position() int

Position is used to export the Position from this struct.

func (*Role) UnmarshalJSON

func (s *Role) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewBot

func NewBot(token string) (*Session, error)

func NewSelfBot

func NewSelfBot(token string) (*Session, error)

func (*Session) AddGuildMemberRole

func (s *Session) AddGuildMemberRole(guildID, userID, roleID Snowflake) error

func (*Session) BanUser

func (s *Session) BanUser(guildID, userID Snowflake, deleteMessageDays int) error

func (*Session) BuildChannel

func (s *Session) BuildChannel(guildID Snowflake, name string) *ChannelBuilder

func (*Session) BulkDeleteMessages

func (s *Session) BulkDeleteMessages(channelID Snowflake, ids []Snowflake) error

func (*Session) Close

func (s *Session) Close()

func (*Session) Connect

func (s *Session) Connect() error

func (*Session) DeleteChannel

func (s *Session) DeleteChannel(channelID Snowflake) error

func (*Session) DeleteMessage

func (s *Session) DeleteMessage(channelID, messageID Snowflake) error

func (*Session) EditEmbed

func (s *Session) EditEmbed(channelID, messageID Snowflake, embed Embed) (*Message, error)

func (*Session) EditEmbeddedMessage

func (s *Session) EditEmbeddedMessage(channelID, messageID Snowflake, content string, embed Embed) (*Message, error)

func (*Session) EditMessage

func (s *Session) EditMessage(channelID, messageID Snowflake, content string) (*Message, error)

func (*Session) GetDMChannel

func (s *Session) GetDMChannel(userID Snowflake) (*Channel, error)

func (*Session) GetLastMessages

func (s *Session) GetLastMessages(channelID Snowflake, limit int) ([]*Message, error)

func (*Session) GetMessage

func (s *Session) GetMessage(channelID, messageID Snowflake) (*Message, error)

func (*Session) GetMessages

func (s *Session) GetMessages(channelID Snowflake, mode GetMessagesMode, target Snowflake, limit int) ([]*Message, error)

func (*Session) KickUser

func (s *Session) KickUser(guildID, userID Snowflake) error

func (*Session) MessageAddReaction

func (s *Session) MessageAddReaction(channelID, messageID Snowflake, emoji string) error

func (*Session) MessageDeleteAllReactions

func (s *Session) MessageDeleteAllReactions(channelID, messageID Snowflake) error

func (*Session) MessageDeleteOwnReaction

func (s *Session) MessageDeleteOwnReaction(channelID, messageID Snowflake, emoji string) error

func (*Session) MessageDeleteReaction

func (s *Session) MessageDeleteReaction(channelID, messageID, userID Snowflake, emoji string) error

func (*Session) PinMessage

func (s *Session) PinMessage(channelID, messageID Snowflake) error

func (*Session) RegisterEventHandler

func (s *Session) RegisterEventHandler(handler interface{})

func (*Session) RemoveGuildMemberRole

func (s *Session) RemoveGuildMemberRole(guildID, userID, roleID Snowflake) error

func (*Session) SendEmbed

func (s *Session) SendEmbed(channelID Snowflake, embed *Embed) (*Message, error)

func (*Session) SendMessage

func (s *Session) SendMessage(channelID Snowflake, content string) (*Message, error)

func (*Session) SendMessageP

func (s *Session) SendMessageP(channelID Snowflake, prototype MessagePrototype) (*Message, error)

func (*Session) SetAvatar

func (s *Session) SetAvatar(imageMimeType string, reader io.Reader) (*User, error)

func (*Session) SetGame

func (s *Session) SetGame(game *Game)

func (*Session) SetStatus

func (s *Session) SetStatus(status Status)

func (*Session) SetStatusGame

func (s *Session) SetStatusGame(status Status, game *Game)

func (*Session) SetUserNick

func (s *Session) SetUserNick(guildID, userID Snowflake, nick string) error

func (*Session) SetUsername

func (s *Session) SetUsername(username string) (*User, error)

func (*Session) Status

func (s *Session) Status() Status

func (*Session) UnbanUser

func (s *Session) UnbanUser(guildID, userID Snowflake) error

type Snowflake

type Snowflake uint64

func ParseSnowflake

func ParseSnowflake(str string) (Snowflake, error)

func (Snowflake) MarshalJSON

func (s Snowflake) MarshalJSON() ([]byte, error)

func (Snowflake) String

func (s Snowflake) String() string

func (Snowflake) Timestamp

func (s Snowflake) Timestamp() time.Time

func (*Snowflake) UnmarshalJSON

func (s *Snowflake) UnmarshalJSON(b []byte) error

type Status

type Status string
const (
	StatusOnline    Status = "online"
	StatusDND       Status = "dnd"
	StatusIdle      Status = "idle"
	StatusInvisible Status = "invisible"
)

type TypingStartEvent

type TypingStartEvent struct {
	ChannelID Snowflake     `json:"channel_id"`
	UserID    Snowflake     `json:"user_id"`
	Timestamp UnixTimeStamp `json:"timestamp"`
}

type UnixTimeStamp

type UnixTimeStamp struct {
	*time.Time
}

func (UnixTimeStamp) MarshalJSON

func (s UnixTimeStamp) MarshalJSON() ([]byte, error)

func (*UnixTimeStamp) UnmarshalJSON

func (s *UnixTimeStamp) UnmarshalJSON(b []byte) error

type User

type User struct {
	// contains filtered or unexported fields
}

User is based on the Discord object with the same name. Any fields can be obtained by calling the respective getters.

func (*User) AvatarHash

func (s *User) AvatarHash() string

AvatarHash is used to export the AvatarHash from this struct.

func (*User) AvatarURL

func (s *User) AvatarURL() string

func (*User) Bot

func (s *User) Bot() bool

Bot is used to export the Bot from this struct.

func (*User) Color

func (s *User) Color(guild *Guild) (int, bool)

func (*User) DiscordJoinDate

func (s *User) DiscordJoinDate() time.Time

func (*User) Discriminator

func (s *User) Discriminator() string

Discriminator is used to export the Discriminator from this struct.

func (*User) EMail

func (s *User) EMail() string

EMail is used to export the EMail from this struct.

func (*User) ID

func (s *User) ID() Snowflake

ID is used to export the ID from this struct.

func (*User) MFAEnabled

func (s *User) MFAEnabled() bool

MFAEnabled is used to export the MFAEnabled from this struct.

func (*User) MarshalJSON

func (s *User) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert this object into its json representation for Discord

func (*User) Mention

func (s *User) Mention() string

func (*User) UnmarshalJSON

func (s *User) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to convert json discord objects back into their respective structs

func (*User) Username

func (s *User) Username() string

Username is used to export the Username from this struct.

func (*User) Verified

func (s *User) Verified() bool

Verified is used to export the Verified from this struct.

type UserUpdateEvent

type UserUpdateEvent struct {
	*User
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL