moltencord

package module
v0.0.0-...-a59c94b Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID string `json:"id"`
	// Use either 0 for guild text channels, 2 for guild voice channels
	// Make sure to check https://discord.com/developers/docs/resources/channel#channel-object-channel-types for more info.
	Type    int    `json:"type"`
	GuildID string `json:"guild_id,omitempty"`
	Name    string `json:"name,omitempty"`
	Topic   string `json:"topic,omitempty"`
	IsNsfw  bool   `json:"nsfw,omitempty"`
	// This field is not set by default. You have to use the FetchGuild() method to fetch it, it will automatically set
	// this field after calling it.
	Guild Guild `json:"-"`
}

Represents a discord channel

func (*Channel) FetchGuild

func (c *Channel) FetchGuild() Guild

func (*Channel) Send

func (c *Channel) Send(msg string) (Message, error)

func (*Channel) SendMessage

func (c *Channel) SendMessage(msg Message) (Message, error)

TODO: implement file support

type Client

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

func NewClient

func NewClient(token string) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Create

func (c *Client) Create(token string) error

func (*Client) GetChannel

func (c *Client) GetChannel(ID string) (Channel, error)

func (*Client) GetGuild

func (c *Client) GetGuild(ID string) (Guild, error)

func (*Client) GetGuilds

func (c *Client) GetGuilds() ([]Guild, error)

type Guild

type Guild struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
	OwnerID     string `json:"owner_id"`

	// Channels are only set after creating a guild. This object will be empty after running Client's GetGuild() method.
	// To fetch channels, use Guild's FetchChannels() method.
	Channels []Channel `json:"channels"`
	// Members are only set after creating a guild. This object will be empty after running Client's GetGuild() method.
	// To fetch Members, use Guild's FetchMembers() method.
	Members []Member `json:"members"`
}

func (*Guild) CreateChannel

func (g *Guild) CreateChannel(c Channel) (Channel, error)

TODO: implement channel creation edits & deletion

func (*Guild) FetchChannels

func (g *Guild) FetchChannels() ([]Channel, error)

Fetches channels from the guild, and returns them in a slice. It also sets the `Channels` field of the guild

func (*Guild) FetchMembers

func (g *Guild) FetchMembers() ([]Member, error)

Fetches members from the guild, and returns them in a slice. It also sets the `Members` field of the guild

func (*Guild) FetchRoles

func (g *Guild) FetchRoles() []Role

func (*Guild) GetChannel

func (g *Guild) GetChannel(ID string) (Channel, error)

func (*Guild) GetMember

func (g *Guild) GetMember(UID string) Member

type Member

type Member struct {
	User     User   `json:"user"`
	Nickname string `json:"nick"`
	Avatar   string `json:"avatar"`

	Deaf bool `json:"deaf"`
	Mute bool `json:"mute"`

	JoinedTimestamp int64 `json:"joined_at"`
}

type Message

type Message struct {
	Content         string     `json:"content,omitempty"`
	Tts             bool       `json:"tts,omitempty"`
	AllowedMentions []struct{} `json:"allowed_mentions,omitempty"`
	// Used to create direct messages. Do not use in guilds.
	Recipient string  `json:"recipient_id,omitempty"`
	Channel   Channel `json:"-"`
}

Represents a discord message

type Role

type Role struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Color       int    `json:"color"`
	Hoist       bool   `json:"hoist"`
	Position    int    `json:"position"`
	Permissions int    `json:"permissions"`
	Mentionalbe bool   `json:"mentionable"`
	Icon        string `json:"icon"`
}

type User

type User struct {
	ID            string `json:"id"`
	Username      string `json:"username"`
	Discriminator string `json:"discriminator"`
	Avatar        string `json:"avatar"`
	Bot           bool   `json:"bot,omitempty"`
	MfaEnabled    bool   `json:"mfa_enabled,omitempty"`
	Banner        string `json:"banner,omitempty"`
	VerifiedEmail bool   `json:"verified,omitempty"`
	NitroType     int    `json:"premium_type,omitempty"`
}

Represents a discord user

func (*User) Send

func (u *User) Send(msg string) error

func (*User) SendMessage

func (u *User) SendMessage(msg Message) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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