gocord

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

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gocord

Discord Bot in Golang

Documentation

Index

Constants

View Source
const (
	EmbedLimitTitle       = 256
	EmbedLimitDescription = 2048
	EmbedLimitFieldValue  = 1024
	EmbedLimitFieldName   = 256
	EmbedLimitField       = 25
	EmbedLimitFooter      = 2048
	EmbedLimit            = 4000
)

Constants for message embed character limits

Variables

View Source
var (
	GuildID   = flag.String("guild", os.Getenv("GUILD_ID"), "Test guild ID. If not passed - bot registers cmds globally")
	BotToken  = flag.String("token", os.Getenv("BOT_TOKEN"), "Bot access token")
	RemoveCmd = flag.Bool("remove", true, "Remove all cmds after shutdowning or not")
)

Functions

func BotCommands

func BotCommands() []*discordgo.ApplicationCommand

func ContainsUserID

func ContainsUserID(elems []string, v string) bool

func CreatePresenceActionRow

func CreatePresenceActionRow() discordgo.ActionsRow

func CreatePresenceEmbed

func CreatePresenceEmbed() *discordgo.MessageEmbed

func CreatePresenceEmbedMessage

func CreatePresenceEmbedMessage(s *discordgo.Session, i *discordgo.InteractionCreate, isUpdated bool)

func CreatePresenceMessage

func CreatePresenceMessage(s *discordgo.Session, i *discordgo.InteractionCreate, startDate time.Time, endDate time.Time)

func NewErrorEmbed

func NewErrorEmbed(errorTitle, errorMsg string, replacements ...interface{}) *discordgo.MessageEmbed

NewErrorEmbed creates a new error embed

func NewErrorEmbedAdvanced

func NewErrorEmbedAdvanced(errorTitle, errorMsg string, errorColor int) *discordgo.MessageEmbed

NewErrorEmbedAdvanced creates a new error embed with a custom color

func NewGenericEmbed

func NewGenericEmbed(embedTitle, embedMsg string, replacements ...interface{}) *discordgo.MessageEmbed

NewGenericEmbed creates a new generic embed

func NewGenericEmbedAdvanced

func NewGenericEmbedAdvanced(embedTitle, embedMsg string, embedColor int) *discordgo.MessageEmbed

NewGenericEmbedAdvanced creates a new generic embed with a custom color

func PresenceButtonsHandlers

func PresenceButtonsHandlers() map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate)

func PresenceHandler

func PresenceHandler() map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate)

func RunDiscordApi

func RunDiscordApi()

func SendResponse

func SendResponse(message string, additionalData []string, s *discordgo.Session, i *discordgo.InteractionCreate)

Types

type Button

type Button struct {
	*discordgo.Button
}

func NewButton

func NewButton() *Button

func (*Button) SetCustomID

func (b *Button) SetCustomID(id string) *Button

func (*Button) SetLabel

func (b *Button) SetLabel(label string) *Button

func (*Button) SetStyle

func (b *Button) SetStyle(style discordgo.ButtonStyle) *Button

type Embed

type Embed struct {
	*discordgo.MessageEmbed
}

Embed ...

func NewEmbed

func NewEmbed() *Embed

NewEmbed returns a new embed object

func (*Embed) AddField

func (e *Embed) AddField(name, value string) *Embed

AddField [name] [value]

func (*Embed) InlineAllFields

func (e *Embed) InlineAllFields() *Embed

InlineAllFields sets all fields in the embed to be inline

func (*Embed) MakeFieldInline

func (e *Embed) MakeFieldInline() *Embed

Adds last field as InLine

func (*Embed) SetAuthor

func (e *Embed) SetAuthor(args ...string) *Embed

SetAuthor ...

func (*Embed) SetColor

func (e *Embed) SetColor(clr int) *Embed

SetColor ...

func (*Embed) SetDescription

func (e *Embed) SetDescription(description string) *Embed

SetDescription [desc]

func (*Embed) SetFooter

func (e *Embed) SetFooter(args ...string) *Embed

SetFooter [Text] [iconURL]

func (*Embed) SetImage

func (e *Embed) SetImage(args ...string) *Embed

SetImage ...

func (*Embed) SetThumbnail

func (e *Embed) SetThumbnail(args ...string) *Embed

SetThumbnail ...

func (*Embed) SetTitle

func (e *Embed) SetTitle(name string) *Embed

SetTitle ...

func (*Embed) SetURL

func (e *Embed) SetURL(URL string) *Embed

SetURL ...

func (*Embed) Truncate

func (e *Embed) Truncate() *Embed

Truncate truncates any embed value over the character limit.

func (*Embed) TruncateDescription

func (e *Embed) TruncateDescription() *Embed

TruncateDescription ...

func (*Embed) TruncateFields

func (e *Embed) TruncateFields() *Embed

TruncateFields truncates fields that are too long

func (*Embed) TruncateFooter

func (e *Embed) TruncateFooter() *Embed

TruncateFooter ...

func (*Embed) TruncateTitle

func (e *Embed) TruncateTitle() *Embed

TruncateTitle ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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