1
0
forked from x/icebergs
This commit is contained in:
shaoying 2019-12-09 14:03:20 +08:00
parent f9a5361c5a
commit 9f0b85bae3
2 changed files with 63 additions and 0 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@
# Dependency directories (remove the comment below to include it) # Dependency directories (remove the comment below to include it)
# vendor/ # vendor/
*.swp

62
type.go Normal file
View File

@ -0,0 +1,62 @@
package ice
import (
"time"
)
type Cache struct {
Value string
Name string
Help string
Hand func(m *Message, x *Cache, arg ...string) string
}
type Config struct {
Value interface{}
Name string
Help string
Hand func(m *Message, x *Config, arg ...string) string
}
type Command struct {
Form map[string]int
Name string
Help interface{}
Auto func(m *Message, c *Context, key string, arg ...string) (ok bool)
Hand func(m *Message, c *Context, key string, arg ...string) (e error)
}
type Context struct {
Name string
Help string
Caches map[string]*Cache
Configs map[string]*Config
Commands map[string]*Command
contexts map[string]*Context
context *Context
root *Context
exit chan bool
Server
}
type Server interface {
Spawn(m *Message, c *Context, arg ...string) Server
Begin(m *Message, arg ...string) Server
Start(m *Message, arg ...string) bool
Close(m *Message, arg ...string) bool
}
type Message struct {
time time.Time
code int
Meta map[string][]string
Data map[string]interface{}
messages []*Message
message *Message
root *Message
source *Context
target *Context
Hand bool
}