本文整理匯總了Golang中github.com/velour/catbase/bot.Bot.Config方法的典型用法代碼示例。如果您正苦於以下問題:Golang Bot.Config方法的具體用法?Golang Bot.Config怎麽用?Golang Bot.Config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/velour/catbase/bot.Bot
的用法示例。
在下文中一共展示了Bot.Config方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: New
// New creates a new LeftpadPlugin with the Plugin interface
func New(bot bot.Bot) *LeftpadPlugin {
p := LeftpadPlugin{
bot: bot,
config: bot.Config(),
}
return &p
}
示例2: New
// NewFactoid creates a new Factoid with the Plugin interface
func New(botInst bot.Bot) *Factoid {
p := &Factoid{
Bot: botInst,
NotFound: []string{
"I don't know.",
"NONONONO",
"((",
"*pukes*",
"NOPE! NOPE! NOPE!",
"One time, I learned how to jump rope.",
},
db: botInst.DB(),
}
_, err := p.db.Exec(`create table if not exists factoid (
id integer primary key,
fact string,
tidbit string,
verb string,
owner string,
created integer,
accessed integer,
count integer
);`)
if err != nil {
log.Fatal(err)
}
for _, channel := range botInst.Config().Channels {
go p.factTimer(channel)
go func(ch string) {
// Some random time to start up
time.Sleep(time.Duration(15) * time.Second)
if ok, fact := p.findTrigger(p.Bot.Config().Factoid.StartupFact); ok {
p.sayFact(msg.Message{
Channel: ch,
Body: "speed test", // BUG: This is defined in the config too
Command: true,
Action: false,
}, *fact)
}
}(channel)
}
return p
}
示例3: New
func New(bot bot.Bot) *TalkerPlugin {
rand.Seed(time.Now().Unix())
return &TalkerPlugin{
Bot: bot,
enforceNicks: bot.Config().EnforceNicks,
sayings: bot.Config().WelcomeMsgs,
}
}
示例4: New
func New(bot bot.Bot) *BabblerPlugin {
plugin := &BabblerPlugin{
Bot: bot,
db: bot.DB(),
config: bot.Config(),
babblers: map[string]*babbler{},
}
return plugin
}
示例5: New
// NewBeersPlugin creates a new BeersPlugin with the Plugin interface
func New(bot bot.Bot) *BeersPlugin {
if bot.DBVersion() == 1 {
if _, err := bot.DB().Exec(`create table if not exists untappd (
id integer primary key,
untappdUser string,
channel string,
lastCheckin integer,
chanNick string
);`); err != nil {
log.Fatal(err)
}
}
p := BeersPlugin{
Bot: bot,
db: bot.DB(),
}
p.LoadData()
for _, channel := range bot.Config().Untappd.Channels {
go p.untappdLoop(channel)
}
return &p
}
示例6: New
func New(bot bot.Bot) *TwitchPlugin {
p := &TwitchPlugin{
Bot: bot,
config: bot.Config(),
twitchList: map[string]*Twitcher{},
}
for _, users := range p.config.Twitch.Users {
for _, twitcherName := range users {
if _, ok := p.twitchList[twitcherName]; !ok {
p.twitchList[twitcherName] = &Twitcher{
name: twitcherName,
game: "",
}
}
}
}
for channel := range p.config.Twitch.Users {
go p.twitchLoop(channel)
}
return p
}