discord

package
v0.0.0-...-bb04232 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DiscordEpoch = 1420070400000

Variables

View Source
var (
	JS_FILE_REGEX    = regexp.MustCompile(`<script src=\"(/assets/\d{4,5}\.[^\"]+\.js)\" defer></script>`)
	BUILD_INFO_REGEX = regexp.MustCompile(`Build Number: \"\).concat\(\"(\d+)\"`)
)

Functions

func ClickButton

func ClickButton(gateway *Gateway, e *types.MessageEventData, interactionID string) bool

func GenerateNonce

func GenerateNonce() string

func GenerateSessionID

func GenerateSessionID() string

func GenerateSuperProperties

func GenerateSuperProperties(gateway *Gateway) string

func SendMessage

func SendMessage(gateway *Gateway, channelID string, content string) bool

func TimeSnowflake

func TimeSnowflake(dt time.Time, high bool) int64

func UtcNow

func UtcNow() time.Time

Types

type Gateway

type Gateway struct {
	CloseChan         chan struct{}
	Closed            bool
	Config            *types.Config
	Connection        *websocket.Conn
	GatewayURL        string
	Handlers          Handlers
	LastSeq           int
	Selfbot           *Selfbot
	SessionID         string
	ClientBuildNumber string
	// contains filtered or unexported fields
}

func CreateGateway

func CreateGateway(selfbot *Selfbot, config *types.Config) *Gateway

func (*Gateway) Close

func (gateway *Gateway) Close() error

func (*Gateway) Connect

func (gateway *Gateway) Connect() error

func (*Gateway) GetMembers

func (gateway *Gateway) GetMembers(id string, ids []string) error

type Handlers

type Handlers struct {
	OnReady             []func(data *types.ReadyEventData)
	OnMessageCreate     []func(data *types.MessageEventData)
	OnMessageUpdate     []func(data *types.MessageEventData)
	OnGuildMembersChunk []func(data *types.GuildMembersChunkEventData)
	OnReconnect         []func()

	OnInvalidated []func()
	// contains filtered or unexported fields
}

func (*Handlers) Add

func (handlers *Handlers) Add(event string, function any) error

type Selfbot

type Selfbot struct {
	Token string
	User  types.User
}

Jump to

Keyboard shortcuts

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