本文整理汇总了Golang中github.com/kylelemons/blightbot/bot.Server类的典型用法代码示例。如果您正苦于以下问题:Golang Server类的具体用法?Golang Server怎么用?Golang Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Server类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: OnConnect
func OnConnect(event string, serv *bot.Server, msg *bot.Message) {
if *nsid != "" {
serv.WriteMessage(bot.NewMessage("", bot.CMD_PRIVMSG, "NickServ", "IDENTIFY "+*nsid))
time.Sleep(3)
}
serv.WriteMessage(bot.NewMessage("", "JOIN", *channel))
}
示例2: OnDisconnect
func OnDisconnect(event string, serv *bot.Server, msg *bot.Message) {
server, pass := serv.Name(), servers[serv.Name()]
log.Printf("Server %q disconnected.", server)
time.Sleep(*delay)
for {
log.Printf("Recnnecting to %q...", server)
if err := serv.Bot().ConnectPass(server, pass); err != nil {
log.Printf("connect: %s", err)
time.Sleep(*rdelay)
continue
}
break
}
}
示例3: delServer
func delServer(event string, serv *bot.Server, msg *bot.Message) {
servers.Lock()
defer servers.Unlock()
delete(servers.m, serv.Name())
}
示例4: addServer
func addServer(event string, serv *bot.Server, msg *bot.Message) {
servers.Lock()
defer servers.Unlock()
servers.m[serv.Name()] = serv
}