template

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ThreadTypeCooldown uint = iota
	ThreadTypeDate
)
View Source
const (
	FlagAutoIncrement = "AUTO_INCREMENT"
	FlagPrimaryKey    = "PRIMARY KEY"
	FlagUnsigned      = "UNSIGNED"
	FlagNotNull       = "NOT NULL"
	FlagUnique        = "UNIQUE"
)

All possiable tags for columns

Variables

View Source
var (
	ErrInvalidCommandUsage = errors.New("Invalid command usage")
	ErrNoPermission        = errors.New("No Permission")
)

Error constants

Functions

This section is empty.

Types

type Command

type Command struct {
	Name            string
	Description     string
	Usage           string
	Example         string
	Permissions     []string      // A list of permissions required to run this
	PermissionLevel uint          // DEPRECIATED
	ResponseTTL     time.Duration // ResponseTTL defines the time the command response can be cached and reused
	Execute         func(*discordgo.Session, *discordgo.MessageCreate, []string) error
}

type Module

type Module struct {
	Name        string
	Description string
	GuildOnly   bool
	Commands    map[string]Command
	Tasks       []*Task
	Permissions []string

	SQLTables []*SQLTable // A number of tables that can be used to hold persistent data
	Depends   []*Module   // Modules the module depends on
}

A Module represents a set of commands and functionalities that have similar usage or work together modules are called using <server prefix> <module name> Name: the name of the module, used for help messages and to call commands of this module Description: basic description of the funtionanlity of this module Args: whether the module takes args --> no more effect GuildOnly: whether the module may only be called from discord servers (officially guilds) Commands: a list of command routes that will be claimed for this module --> no more effect SubCommands: a list of commands of this module, the map identifier is the command's name Threads: a list of background threads to be executed for each guild in specific time intervals Execute: not used anymore, see SubCommad.Execute and use command specific execute calls

type ModuleResponse

type ModuleResponse struct {
	Code  uint // 0 = noerror / 1 = invalidCommandUsage / 2 = permissionDenied / 3 = InternalServerError
	Error error
}

ModuleResponse contains the data returned by the called commands goroutine

type SQLColumn

type SQLColumn struct {
	Name  string
	Type  string
	Flags []string
}

type SQLTable

type SQLTable struct {
	ID      string // Unique Identifier of the table
	Columns []*SQLColumn
}

SQLTable can be used to save persistent data

type Task

type Task struct {
	Name     string
	Execute  func(s *discordgo.Session) error
	Schedule *TaskSchedule
}

A Task defines a reapeating background job

type TaskSchedule

type TaskSchedule struct {
	Every    uint64
	Interval time.Duration
	Weekday  time.Weekday
	AtTime   string
}

TaskSchedule defines when a task should be run

Jump to

Keyboard shortcuts

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