teletran

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

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

Go to latest
Published: Jun 28, 2018 License: BSD-2-Clause Imports: 11 Imported by: 0

README

teletran

Discord Bot Framework

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

func NewBot

func NewBot(config *Config) (*Bot, error)

func (*Bot) AddAdminCommand

func (b *Bot) AddAdminCommand(name string, help string, command Command)

func (*Bot) AddCommand

func (b *Bot) AddCommand(name string, help string, command Command)

func (*Bot) GetDbBucket

func (b *Bot) GetDbBucket(bucketName string) storm.Node

func (*Bot) IsAdmin

func (b *Bot) IsAdmin(ctx *CommandContext) bool

func (*Bot) Run

func (bot *Bot) Run()

type Command

type Command func(ctx *CommandContext, args []string)

type CommandContext

type CommandContext struct {
	Session *discordgo.Session
	Message *discordgo.MessageCreate
	Bot     *Bot
	// contains filtered or unexported fields
}

func (*CommandContext) IsAdmin

func (ctx *CommandContext) IsAdmin() bool

func (*CommandContext) LookupUser

func (ctx *CommandContext) LookupUser(user string) (string, error)

func (*CommandContext) SendResponse

func (ctx *CommandContext) SendResponse(message string)

func (*CommandContext) Write

func (ctx *CommandContext) Write(p []byte) (n int, err error)

Implement io.Writer interface

type CommandSet

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

func NewCommandSet

func NewCommandSet() *CommandSet

func (*CommandSet) AddCommand

func (c *CommandSet) AddCommand(name string, help string,
	run Command, needsAdmin bool)

func (*CommandSet) Exec

func (c *CommandSet) Exec(ctx *CommandContext, args []string)

func (*CommandSet) Help

func (c *CommandSet) Help(ctx *CommandContext)

func (*CommandSet) HelpMsg

func (c *CommandSet) HelpMsg(isAdmin bool) string

type Config

type Config struct {
	Token         string `json:"token"`
	ClientId      string `json:"client_id"`
	CommandPrefix string `json:"command_prefix"`
}

Directories

Path Synopsis
cmd
teletran command

Jump to

Keyboard shortcuts

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