selfbot

package
v0.0.0-...-5074445 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Footer = &discordgo.MessageEmbedFooter{
	Text: "by draven#4562\ngithub.com/rmccrystal/discord-selfbot",
}

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string
	Aliases     []string
	Run         func(bot *Selfbot, args []string, message *discordgo.Message) (userError, err error)
	Description string
	Usage       string
	MinArgs     int
}

type CommandList

type CommandList struct {
	Commands []Command
}

func NewCommandList

func NewCommandList() CommandList

func (*CommandList) AddCommand

func (list *CommandList) AddCommand(command Command)

func (CommandList) FindCommand

func (list CommandList) FindCommand(command string) *Command

FindCommand finds a command in the commandlist using the name or alias. If no commands with the specified command or alias exist, it will return nil.

func (CommandList) Run

func (list CommandList) Run(bot *Selfbot, command string, args []string, message *discordgo.Message) (userError, err error)

Run finds and runs a command based on the command and arguments

type Config

type Config struct {
	Token            string `json:"token"`
	Prefix           string `json:"prefix"`
	DefaultAsciiFont string `json:"default_ascii_font"`
}

Config represents what can be configured about a selfbotsession. Usually loaded from a JSON Config file.

func NewConfigDefault

func NewConfigDefault(token string) Config

func NewConfigFromJson

func NewConfigFromJson(jsonBytes []byte) (Config, error)

func NewConfigsFromJson

func NewConfigsFromJson(jsonBytes []byte) ([]Config, error)

type Interactive

type Interactive struct {
	// contains filtered or unexported fields
}

Interactive is an interactive session for selfbot users. While this session is active, the selfbot will not accept commands and instead input will be sent to this struct.

To Read from an interactive session, you can use a bufio.Reader. Messages are separated by a null character ('\000')

func (*Interactive) Close

func (i *Interactive) Close() error

func (*Interactive) Read

func (i *Interactive) Read(p []byte) (n int, err error)

Read reads data from the read buffer which is updated every new message sent. This can be easily read from using a Reader

func (*Interactive) ReadString

func (i *Interactive) ReadString() (message string, eof bool)

ReadString reads a single message from the session. If there are no messages waiting, it will wait until a message is sent. If the session is closed, eof will be true

func (*Interactive) Write

func (i *Interactive) Write(p []byte) (n int, err error)

Write writes a response to the channel

func (*Interactive) WriteString

func (i *Interactive) WriteString(message string) (eof bool)

type Selfbot

type Selfbot struct {
	Session     *discordgo.Session
	User        *discordgo.User
	Config      Config
	CommandList CommandList
	Log         *log.Entry
	RemovedPins []discordgo.Message
	// contains filtered or unexported fields
}

Selfbot represents all information required to run a selfbot. Multiple selfbots can be created with this struct

func NewSelfbot

func NewSelfbot(config Config, commands CommandList) (Selfbot, error)

func (*Selfbot) Close

func (bot *Selfbot) Close()

func (*Selfbot) SendInfo

func (bot *Selfbot) SendInfo(channelID, info string, clean bool) error

func (*Selfbot) StartInteractive

func (bot *Selfbot) StartInteractive(channelID string, consumeMessages bool) *Interactive

StartInteractive starts a new interactive session

Jump to

Keyboard shortcuts

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