decoupled some stuffs, news related tests, new commands file
This commit is contained in:
@ -5,7 +5,6 @@ import (
|
||||
"log"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@ -20,16 +19,6 @@ type Config struct {
|
||||
} `yaml:"talkback"`
|
||||
}
|
||||
|
||||
type Command struct {
|
||||
name string
|
||||
desc string
|
||||
example string
|
||||
command func(
|
||||
s *discordgo.Session,
|
||||
m *discordgo.MessageCreate,
|
||||
message string)
|
||||
}
|
||||
|
||||
func (c *Config) LoadConf() *Config {
|
||||
yamlFile, err := ioutil.ReadFile("config.yaml")
|
||||
if err != nil {
|
||||
@ -42,23 +31,4 @@ func (c *Config) LoadConf() *Config {
|
||||
return c
|
||||
}
|
||||
|
||||
var CommandRegister = make(
|
||||
map[string]Command)
|
||||
|
||||
func SetCommand(
|
||||
aliases []string,
|
||||
desc string,
|
||||
example string,
|
||||
command func(s *discordgo.Session, m *discordgo.MessageCreate, message string)) {
|
||||
for _, alias := range aliases {
|
||||
c := Command{
|
||||
name: alias,
|
||||
desc: desc,
|
||||
example: example,
|
||||
command: command}
|
||||
CommandRegister[alias] = c
|
||||
log.Printf("added %s to Register", alias)
|
||||
}
|
||||
}
|
||||
|
||||
var ConfigRegister Config
|
||||
|
||||
Reference in New Issue
Block a user