command

package
v0.0.0-...-e7acbab Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CALL_ERR_OK    = 0
	CALL_ERR_REDIS = iota
	CALL_ERR_KEY_NOT_FOUND
	CALL_ERR_NOPERM
	CALL_ERR_MSGPACK_FAIL
	CALL_ERR_VALUE_EXIST
	CALL_ERR_NO_SUCH_GAME
)

Variables

View Source
var GroupUUID = uuid.Must(uuid.NewV4()).String()

Functions

func AddPhrase

func AddPhrase()

func CQRegister

func CQRegister(handle CQCommandHandler, command string) (err error)

func Call

func Call(bot *tg.BotAPI, req *tg.Message)

func Cancel

func Cancel(bot *tg.BotAPI, req *tg.Message)

func Cooldown

func Cooldown(bot *tg.BotAPI, req *tg.Message)

func Del

func Del(bot *tg.BotAPI, req *tg.Message)

func Done

func Done(bot *tg.BotAPI, req *tg.Message)

func ExecPipeline

func ExecPipeline(bot *tg.BotAPI, m *tg.Message, name string) (ret bool)

Note: here we can safely access pipeline concurrently TODO: concurrent access to pipeline

func Help

func Help(bot *tg.BotAPI, req *tg.Message)

func List

func List(bot *tg.BotAPI, req *tg.Message)

func LiveParty

func LiveParty(bot *tg.BotAPI, req *tg.Message)

we use this id to determine whether we have a live party function or not LiveParty is a cgss group limited function

func LivePartyAtAll

func LivePartyAtAll(bot *tg.BotAPI, req *tg.Message)

LivePartyAtAll will be registered as lpall

func LivePartyShowUser

func LivePartyShowUser(bot *tg.BotAPI, req *tg.Message)

LivePartyShowUser will show the party table info

func Lock

func Lock(bot *tg.BotAPI, req *tg.Message)

func Ping

func Ping(bot *tg.BotAPI, req *tg.Message)

func PipelinePush

func PipelinePush(p Pipe, name string) (err error)

func Rank

func Rank(bot *tg.BotAPI, req *tg.Message)

func Register

func Register(handle CommandHandler, command string) (err error)

func Remind

func Remind(bot *tg.BotAPI, req *tg.Message)

func TODO

func TODO(bot *tg.BotAPI, req *tg.Message)

func TODONow

func TODONow(bot *tg.BotAPI, req *tg.Message)

func Test

func Test(bot *tg.BotAPI, req *tg.Message)

func Track

func Track(bot *tg.BotAPI, req *tg.Message)

func Unlock

func Unlock(bot *tg.BotAPI, req *tg.Message)

func Users

func Users(bot *tg.BotAPI, req *tg.Message)

func Weblogin

func Weblogin(bot *tg.BotAPI, req *tg.Message)

func Workon

func Workon(bot *tg.BotAPI, req *tg.Message)

Types

type CQCommandHandler

type CQCommandHandler func(*tg.BotAPI, *tg.CallbackQuery)

func CQLookup

func CQLookup(cq *tg.CallbackQuery) (h CQCommandHandler, err error)

type CallError

type CallError int

func (CallError) Error

func (c CallError) Error() string

type CommandHandler

type CommandHandler func(*tg.BotAPI, *tg.Message)

TODO: merge command, cq command to a interface TODO: Change Handlers into interface

func Lookup

func Lookup(command string) (h CommandHandler, err error)

type GameList

type GameList []GameObj

type GameObj

type GameObj struct {
	Name        string `msgpack:"name"`
	Description string `msgpack:"description"`
}

type Pipe

type Pipe func(*tg.BotAPI, *tg.Message) bool // if retval = false, stop the pipeline and stop the following process

type Pipeline

type Pipeline []Pipe

type UserList

type UserList []UserObj

type UserObj

type UserObj struct {
	Name string `msgpack:"name"`
	ID   int    `msgpack:"id"`
}

The data in redis should store like this 1. chat specified games list key = games.groupID, value = a list of msgpack string 2. chat specified usercall list key = call.groupID.gameName, value = a list of msgpack objects 3. chat specified default game key = defaut.groupID, value = empty or a msgpack string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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