本文整理汇总了Golang中github.com/velour/catbase/bot.Bot类的典型用法代码示例。如果您正苦于以下问题:Golang Bot类的具体用法?Golang Bot怎么用?Golang Bot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bot类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewRemember
// NewRememberPlugin creates a new RememberPlugin with the Plugin interface
func NewRemember(b bot.Bot) *RememberPlugin {
p := RememberPlugin{
Bot: b,
Log: make(map[string][]msg.Message),
db: b.DB(),
}
return &p
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:remember.go
示例2: New
func New(bot bot.Bot) *BabblerPlugin {
plugin := &BabblerPlugin{
Bot: bot,
db: bot.DB(),
config: bot.Config(),
babblers: map[string]*babbler{},
}
return plugin
}
开发者ID:velour,项目名称:catbase,代码行数:10,代码来源:babbler.go
示例3: New
// NewFirstPlugin creates a new FirstPlugin with the Plugin interface
func New(b bot.Bot) *FirstPlugin {
if b.DBVersion() == 1 {
_, err := b.DB().Exec(`create table if not exists first (
id integer primary key,
day integer,
time integer,
body string,
nick string
);`)
if err != nil {
log.Fatal("Could not create first table: ", err)
}
}
log.Println("First plugin initialized with day:", midnight(time.Now()))
first, err := getLastFirst(b.DB())
if err != nil {
log.Fatal("Could not initialize first plugin: ", err)
}
return &FirstPlugin{
Bot: b,
db: b.DB(),
First: first,
}
}
开发者ID:velour,项目名称:catbase,代码行数:28,代码来源:first.go
示例4: 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
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:leftpad.go
示例5: New
// NewCounterPlugin creates a new CounterPlugin with the Plugin interface
func New(bot bot.Bot) *CounterPlugin {
if bot.DBVersion() == 1 {
if _, err := bot.DB().Exec(`create table if not exists counter (
id integer primary key,
nick string,
item string,
count integer
);`); err != nil {
log.Fatal(err)
}
}
return &CounterPlugin{
Bot: bot,
DB: bot.DB(),
}
}
开发者ID:velour,项目名称:catbase,代码行数:17,代码来源:counter.go
示例6: 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
}
开发者ID:velour,项目名称:catbase,代码行数:48,代码来源:factoid.go
示例7: New
func New(bot bot.Bot) *TalkerPlugin {
rand.Seed(time.Now().Unix())
return &TalkerPlugin{
Bot: bot,
enforceNicks: bot.Config().EnforceNicks,
sayings: bot.Config().WelcomeMsgs,
}
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:talker.go
示例8: New
// NewAdminPlugin creates a new AdminPlugin with the Plugin interface
func New(bot bot.Bot) *AdminPlugin {
p := &AdminPlugin{
Bot: bot,
db: bot.DB(),
}
p.LoadData()
return p
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:admin.go
示例9: New
// NewDowntimePlugin creates a new DowntimePlugin with the Plugin interface
func New(bot bot.Bot) *DowntimePlugin {
p := DowntimePlugin{
Bot: bot,
db: bot.DB(),
}
if bot.DBVersion() == 1 {
_, err := p.db.Exec(`create table if not exists downtime (
id integer primary key,
nick string,
lastSeen integer
);`)
if err != nil {
log.Fatal("Error creating downtime table: ", err)
}
}
return &p
}
开发者ID:velour,项目名称:catbase,代码行数:20,代码来源:downtime.go
示例10: 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
}
开发者ID:velour,项目名称:catbase,代码行数:23,代码来源:beers.go
示例11: 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
}
开发者ID:velour,项目名称:catbase,代码行数:24,代码来源:twitch.go
注:本文中的github.com/velour/catbase/bot.Bot类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论