本文整理匯總了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
}