discord

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoGuildID = errors.New("no guild ID set under viper discord.guildID or env DISCORD_GUILD_ID")

ErrNoGuildID is the error returned when no guild ID is set.

Functions

func DefaultGuildID

func DefaultGuildID() string

DefaultGuildID returns the Discord guild ID. It can be used by app who don't want to use complex logic to retrieve the guild ID and only want to manage a single guild.

func SetDefaultClient

func SetDefaultClient(c *Client)

SetDefaultClient sets the global Discord client used by app who don't want to create their own client.

Types

type Client

type Client struct {
	*discordgo.Session
}

Client is a wrapper around the discordgo.Session type. It is used to simplify the usage of the discordgo.Session type.

func DefaultClient

func DefaultClient() *Client

DefaultClient returns the global Discord client used by app who don't want to create their own client. If no client has been set, it will create a new one.

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Discord client. It will automatically login to Discord using the Discord token specified in the environment variable

func (*Client) InviteOnOurDiscord

func (c *Client) InviteOnOurDiscord(ctx context.Context, token, userID string) error

InviteOnOurDiscord invites a user to the S42 server using the Discord API. the discord guild id can be set in the environment variable DISCORD_GUILD_ID.

Jump to

Keyboard shortcuts

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