本文整理匯總了Golang中github.com/fluffle/goirc/client.Line.Text方法的典型用法代碼示例。如果您正苦於以下問題:Golang Line.Text方法的具體用法?Golang Line.Text怎麽用?Golang Line.Text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/fluffle/goirc/client.Line
的用法示例。
在下文中一共展示了Line.Text方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: run
func (self *ModManager) run(event string, line *irc.Line) {
self.mut.RLock()
defer self.mut.RUnlock()
for _, mod := range self.modules {
// Module should check if enabled, not handlers
go mod.Handle(module.Event(event), line.Text(), line)
}
}
示例2: message
func (ei *EndpointIRC) message(c *irc.Conn, l *irc.Line) {
var messageTarget MessageTarget
if l.Public() {
messageTarget = ei.GetChannel(l.Target())
} else {
messageTarget = ei.GetUser(l.Target())
}
ei.handler(l.Text(), ei.GetUser(l.Nick), l.Target(), messageTarget)
}
示例3: Handle
// Implement client.Handler so commandSet can Handle things directly.
func (cs *commandSet) Handle(conn *client.Conn, line *client.Line) {
// This is a dirty hack to treat factoid additions as a special
// case, since they may begin with command string prefixes.
ctx := context(conn, line)
if ctx == nil || util.IsFactoidAddition(line.Text()) {
return
}
if r, ln := cs.match(ctx.Text()); ctx.Addressed && r != nil {
// Cut command off, trim and compress spaces.
ctx.Args[1] = strings.Join(strings.Fields(ctx.Args[1][ln:]), " ")
r.Run(ctx)
}
}
示例4: parsePacket
func (ib *IrcBot) parsePacket(conn *irc.Conn, line *irc.Line) *models.Packet {
result := ib.regex.FindStringSubmatch(line.Text())
if result == nil {
return nil
}
fileName := cleanFileName(result[3])
packet := models.NewPacket(result[1], result[2], fileName, line.Nick, line.Target(), ib.server.Name, line.Time)
//save packet
if packet != nil {
ib.dataService.SavePacket(packet)
}
return packet
}
示例5: handle_privmsg
// Handle privmsgs
func handle_privmsg(conn *irc.Conn, line *irc.Line) {
text := line.Text()
args := strings.Split(text, " ")
//var url_regex = regexp.MustCompile(`\Ahttps?://([[:alnum:]][a-zA-Z0-9-]{1,61}[[:alnum:]]\.?){2,3}((%[0-9A-Fa-f]{2}|[-_.!~*';/?#:@&=+$,A-Za-z0-9])+)?\z`)
var url_regex = regexp.MustCompile(`\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))`)
// handle a prefixed command
if strings.Index(text, RC.CmdPrefix) == 0 {
handle_command(conn, line, args)
} else if len(url_regex.FindString(text)) > 0 {
s := GetScanner()
s.Handle(conn, line, text)
}
// Handle mocking
if RC.Mocking[line.Nick] {
SendMessage(conn, "Hey, everybody! "+line.Nick+" said something!", nil)
SendMessage(conn, line.Nick+": "+line.Text(), nil)
SendMessage(conn, "Great job, "+line.Nick+"! ╭(ᐛ)و", nil)
}
}
示例6: handleNotice
func (ib *IrcBot) handleNotice(conn *irc.Conn, line *irc.Line) {
log.Printf("[NOTICE] %v", line.Text())
ib.logToConsole("[NOTICE] " + line.Text())
}
示例7: log372
func (ib *IrcBot) log372(conn *irc.Conn, line *irc.Line) {
ib.logToConsole(line.Text())
}