jeff

package module
v0.0.3-0...-8ab802a Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

README

Jeff

A helper library for writing discord bots

Go Report Card GoDoc

Documentation

Overview

Package jeff - A helper library for writing discord bots

Index

Constants

View Source
const VERSION = "0.0.2"

VERSION is jeff's version

Variables

View Source
var ErrCmdArgsNotUnique = &InternalError{"The flags and subcommands must all be unique."}

ErrCmdArgsNotUnique is the error for when a flag and subcommand share the same name

View Source
var ErrCmdContainsIllegalChars = &InternalError{"The command, subcommand or flag contains illegal character."}

ErrCmdContainsIllegalChars is the error for commands, subcommands and flags that contain illegal characters

View Source
var ErrCmdExists = &InternalError{"A command with that name already exists for this session."}

ErrCmdExists is the error for preexisting commands

View Source
var ErrMessageSessionNil = &InternalError{"The session linked to the message is a nil pointer."}

ErrMessageSessionNil is the error when the session linked to a message is a nil pointer

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler func(s *Session, m *Message, c ParsedCommand)

CommandHandler - A function to handle a parsed command

type InternalError

type InternalError struct {
	ErrorString string
}

InternalError - A jeff internal error

func (*InternalError) Error

func (err *InternalError) Error() string

type Message

type Message struct {
	*discordgo.Message
	// contains filtered or unexported fields
}

Message - A message object that implements *discordgo.Message, but with jeff methods

func (*Message) Reply

func (m *Message) Reply(msg string) (*Message, error)

Reply - Send a reply to message

type ParsedCommand

type ParsedCommand struct {
	Cmd     string
	Flags   []string
	Subcmds []struct {
		Cmd string
		Arg string
	}
	Arg string
}

ParsedCommand - A parsed command

type Session

type Session struct {
	*discordgo.Session
	Prefix string
	// contains filtered or unexported fields
}

Session - Session object for a given connection, implements *discordgo.Session

func New

func New(token string) (s *Session, err error)

New - Create a new session

func (*Session) NewCommand

func (ses *Session) NewCommand(cmd string, flags []string, subcmds []string, handler CommandHandler) error

NewCommand - Define a new command

func (*Session) Run

func (ses *Session) Run() (err error)

Run - Open the session and hang until interrupt

Jump to

Keyboard shortcuts

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