Documentation ¶
Index ¶
- Constants
- type Attachment
- type Author
- type Channel
- type Client
- func (c *Client) ChannelMessageSend(channelId int, messageText string) (responseMessage Message, err error)
- func (c *Client) GuildChannels(guildId int) (channels []Channel, err error)
- func (c *Client) IsLoggedIn() (isLoggedIn bool)
- func (c *Client) Listen() (err error)
- func (c *Client) Login(email string, pass string) (err error)
- func (c *Client) StopListen()
- func (c Client) UserGuilds() (guilds []Guild, err error)
- func (c *Client) UserMe() (err error)
- type Embed
- type Event
- type Guild
- type GuildCreateEvent
- type GuildDeleteEvent
- type GuildMemberEvent
- type GuildRoleDeleteEvent
- type GuildRoleEvent
- type Member
- type Message
- type PermissionOverwrites
- type Presence
- type PrivateChannel
- type Provider
- type ReadState
- type Ready
- type Role
- type Thumbnail
- type TypingEvent
- type User
- type UserSettings
- type Video
- type VoiceState
Constants ¶
const DISCORD_URL = "https://discordapp.com/api"
Discord URL path
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { Width int Url string Size int ProxyURL string ID int `json:"id,string"` Filename string }
Attachment array entry
type Author ¶
type Author struct { Username string Discriminator int `json:",string"` ID int `json:"id,string"` Avatar string }
An author of a message
type Channel ¶
type Channel struct { GuildID int `json:"guild_id,string,omitempty"` Name string PermissionOverwrites []PermissionOverwrites `json:"permission_overwrites,omitempty"` Topic string Position int `json:",omitempty"` LastMessageID string `json:"last_message_id"` Type string ID int `json:",string,omitempty"` IsPrivate bool }
Channels are sections inside guilds that messages are grouped by
type Client ¶
type Client struct { User Token string GatewayURL string `json:"url"` Guilds []Guild PrivateChannel []PrivateChannel OnReady func(Event, Ready) OnTypingStart func(Event, TypingEvent) OnMessageCreate func(Event, Message) OnMessageUpdate func(Event, Message) OnMessageDelete func(Event, Message) OnPresenceStart func(Event, Presence) OnPresenceUpdate func(Event, Presence) OnUserSettingsUpdate func(Event, UserSettings) OnGuildCreate func(Event, GuildCreateEvent) OnGuildUpdate func(Event, Guild) OnGuildDelete func(Event, GuildDeleteEvent) OnGuildIntegrationsUpdate func(Event, GuildMemberEvent) OnGuildMemberAdd func(Event, GuildMemberEvent) OnGuildMemberUpdate func(Event, GuildMemberEvent) OnGuildMemberRemove func(Event, GuildMemberEvent) OnGuildRoleDelete func(Event, GuildRoleDeleteEvent) OnGuildRoleUpdate func(Event, Guild) OnGuildRoleCreate func(Event, GuildRoleEvent) OnVoiceStateUpdate func(Event, VoiceState) // contains filtered or unexported fields }
Client wraps all Discord methods
func (*Client) ChannelMessageSend ¶
func (c *Client) ChannelMessageSend(channelId int, messageText string) (responseMessage Message, err error)
Send a message to specified channel
func (*Client) GuildChannels ¶
List channels found on given guildId
func (*Client) IsLoggedIn ¶
IsLoggedIn returns if client is logged in to discord
func (Client) UserGuilds ¶
Get a list of guilds for current logged in user
type Embed ¶
type Embed struct { Author Author Description string Provider Provider Thumbnail Thumbnail Title string Type string Url string Video Video }
Embedded media array entry
type Guild ¶
type Guild struct { VoiceStates []VoiceState //Used by Websocket JoinedAt string AfkChannelID int `json:"afk_channel_id,string,omitempty"` AfkTimeout int ID int `json:"id,string,omitempty"` Icon int `json:"omitempty"` Name string Roles []Role Region string Presences []Presence //Used by Websocket EmbedChannelID int `json:"embed_channel_id,string,omitempty"` EmbedEnabled bool OwnerID int `json:"owner_id,string,omitempty"` Members []Member Large bool //Used by Websocket Channels []Channel //Used by Websocket }
A guild are basically servers on Discord
type GuildCreateEvent ¶
type GuildCreateEvent struct { ID string `json:"id,string"` // contains filtered or unexported fields }
type GuildDeleteEvent ¶
type GuildDeleteEvent struct {
GuildCreateEvent
}
type GuildMemberEvent ¶
type GuildRoleDeleteEvent ¶
type GuildRoleDeleteEvent struct { GuildID int `json:"guild_id,string"` RoleID int `json:"role_id, string"` }
GuildRoleDelete is used when a delete roleevent occurs for guild
type GuildRoleEvent ¶
GuildRole is used when a CRUD operation happens with roles in a guild
type Message ¶
type Message struct { Attachments []Attachment Tts bool Embeds []Embed Timestamp string MentionEveryone bool Nonce string //Used by websocket ID int `json:"id,string,omitempty"` EditedTimestamp string Author User Content string ChannelID int `json:"channel_id,string,omitempty"` Mentions []User }
Posted message inside a channel
type PermissionOverwrites ¶
type PermissionOverwrites struct { }
Channel setting regarding if a permission overwrites
type PrivateChannel ¶
type PrivateChannel struct { ID string `json:"id"` Recipient User `json:"recipient"` LastMessageID string `json:"last_message_id"` }
Private Channels between two users
type Role ¶
type Role struct { Managed bool Name string Color int Hoist bool Position int ID int `json:"id,string"` Permissions int }
Roles are permission groupings