client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscordApiURL = "https://discord.com/api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BotClient

type BotClient struct {
	Token  string
	Client *http.Client
}

func NewBot

func NewBot(token string) *BotClient

func (*BotClient) GetGuildClient

func (botClient *BotClient) GetGuildClient(guildId discord.Snowflake) *GuildClient

func (*BotClient) MakeRequest

func (botClient *BotClient) MakeRequest(discordRequest DiscordRequest) (response *http.Response, err error)

type DiscordRequest

type DiscordRequest struct {
	ExpectedStatus int
	Method         string
	Endpoint       string
	Body           []byte

	UnmarshalTo interface{}

	DisableAuth        bool
	DisableStatusCheck bool
	AdditionalHeaders  map[string]string
}

func (*DiscordRequest) GetUrl

func (discordRequest *DiscordRequest) GetUrl() string

func (*DiscordRequest) ValidateEndpoint

func (discordRequest *DiscordRequest) ValidateEndpoint()

type GuildClient

type GuildClient struct {
	GuildId discord.Snowflake
	Bot     *BotClient
}

func (*GuildClient) GetMemberClient

func (guildClient *GuildClient) GetMemberClient(memberId discord.Snowflake) *MemberClient

func (*GuildClient) MakeRequest

func (guildClient *GuildClient) MakeRequest(discordRequest DiscordRequest) (response *http.Response, err error)

type MemberClient

type MemberClient struct {
	MemberId    discord.Snowflake
	GuildClient *GuildClient
}

func (*MemberClient) AddRoleToMember

func (memberClient *MemberClient) AddRoleToMember(opts ModifyMemberRoleOpts) error

func (*MemberClient) FetchMember

func (memberClient *MemberClient) FetchMember() (*discord.Member, error)

func (*MemberClient) MakeRequest

func (memberClient *MemberClient) MakeRequest(discordRequest DiscordRequest) (response *http.Response, err error)

type ModifyMemberRoleOpts

type ModifyMemberRoleOpts struct {
	RoleID discord.Snowflake

	Reason string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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