本文整理汇总了Golang中github.com/sorcix/irc.Message.Params方法的典型用法代码示例。如果您正苦于以下问题:Golang Message.Params方法的具体用法?Golang Message.Params怎么用?Golang Message.Params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/sorcix/irc.Message
的用法示例。
在下文中一共展示了Message.Params方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PrivacyFilterIrcmsg
func PrivacyFilterIrcmsg(message *irc.Message) *irc.Message {
if message == nil {
return nil
}
if message.Command == irc.PRIVMSG || message.Command == irc.NOTICE {
message.Trailing = "<privacy filtered>"
}
if message.Command == irc.PASS {
message.Params = []string{"<privacy filtered>"}
message.Trailing = ""
}
return message
}
示例2: MessageHandler
func MessageHandler(s ircx.Sender, m *irc.Message) {
msg := m.Trailing
var command string
if m.Params[0] == name {
m.Params = []string{m.Name}
}
if strings.HasPrefix(strings.ToLower(msg), strings.ToLower(name)) {
pieces := strings.Split(msg, " ")
if len(pieces) >= 2 {
command = pieces[1]
runCommand(command, pieces, msg, s, m)
return
}
} else if strings.HasPrefix(msg, prefix) {
pieces := strings.Split(msg, " ")
if len(pieces) >= 1 {
command = pieces[0][1:]
runCommand(command, pieces, msg, s, m)
return
}
} else if strings.HasPrefix(msg, "\x01VERSION") {
log.Println(ctcp.VersionReply())
s.Send(&irc.Message{
Command: irc.PRIVMSG,
Params: m.Params,
Trailing: ctcp.VersionReply(),
})
return
} else {
for k := range replies {
if ok := k.FindAllString(msg, 1); ok != nil {
s.Send(&irc.Message{
Command: irc.PRIVMSG,
Params: m.Params,
Trailing: replies[k],
})
return
}
}
}
}
示例3: rawHandler
func (net *netImpl) rawHandler(evt *msg.Message) {
// libmauirc adds the trailing text as a param, remove it.
evt.Params = evt.Params[:len(evt.Params)-1]
net.Owner.SendMessage(messages.Container{Type: messages.MsgRaw, Object: messages.RawMessage{Network: net.GetName(), Message: evt.String()}})
}