core

package
v0.0.0-...-8f470b2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NAME = "kusoDD_bot"
)

Variables

View Source
var (
	LV = make(map[string]int)
)

Functions

func NewAnimationUpload

func NewAnimationUpload(chatid int64, file interface{}) tgbotapi.AnimationConfig

func NewChatAction

func NewChatAction(chatid int64, action string) tgbotapi.ChatActionConfig

func NewDocumentUpload

func NewDocumentUpload(chatid int64, file interface{}) tgbotapi.DocumentConfig

func NewFileBytes

func NewFileBytes(filename string, fr io.Reader, size int64) tgbotapi.FileReader

func NewFileConfig

func NewFileConfig(fid string) tgbotapi.FileConfig

func NewMessage

func NewMessage(chatid int64, text string) tgbotapi.MessageConfig

Types

type Bot

type Bot struct {
	Conf *Config
	Json jsoniter.API

	*tgbotapi.BotAPI
	// contains filtered or unexported fields
}

func NewBot

func NewBot(conf *Config, mode string, debug bool) (b *Bot, e error)

func (*Bot) Done

func (b *Bot) Done() <-chan struct{}

func (*Bot) NewPlugin

func (b *Bot) NewPlugin(name string, f func(Message) <-chan bool, timeout time.Duration, opts []Opt)

func (*Bot) Printf

func (b *Bot) Printf(format string, v ...interface{})

func (*Bot) Println

func (b *Bot) Println(v ...interface{})

func (*Bot) Run

func (b *Bot) Run() (e error)

func (*Bot) Stop

func (b *Bot) Stop()

func (*Bot) WithCancel

func (b *Bot) WithCancel() (context.Context, func())

func (*Bot) WithTimeout

func (b *Bot) WithTimeout(timeout time.Duration) (context.Context, func())

type Config

type Config struct {
	Token   string                            `json:"token"`
	Server  Server                            `json:"server"`
	Plugins map[string]map[string]interface{} `json:"plugins"`
}

func ResolvConf

func ResolvConf(conf string) (c *Config, e error)

type Message

type Message struct {
	tgbotapi.Update
	Bot *Bot
}

func (Message) CaptionCommand

func (m Message) CaptionCommand() string

type Opt

type Opt struct{}

type Plugin

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

type Server

type Server struct {
	Host string `json:"host"`
	Path string `json:"path"`
	Port int16  `json:"port"`
	TLS  *TLS   `json:"tls"`
}

type TLS

type TLS struct {
	Cert string `json:"cert"`
	Key  string `json:"Key"`
}

Jump to

Keyboard shortcuts

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