From 3ac6bf23932f7b6f177bbc59d52b956131f9c009 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Sun, 28 Feb 2016 13:00:08 +0100 Subject: [PATCH] Version info as ctcp action. --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 5a8cbc7..d68c647 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,7 @@ import ( "github.com/nickvanw/ircx" "github.com/sorcix/irc" + "github.com/sorcix/irc/ctcp" "flokatirc/modules" "flokatirc/version" @@ -106,9 +107,9 @@ func ConnectHandler(s ircx.Sender, m *irc.Message) { Params: []string{ch}, }) } - time.Sleep(5 * time.Second) - //sayCh <- fmt.Sprintf("%s\n\001ACTION running on %s", "*", SoftwareInfo()) - sayCh <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo()) + time.Sleep(2 * time.Second) + msg := ctcp.Encode(ctcp.ACTION, fmt.Sprintf("running on %s", SoftwareInfo())) + sayCh <- fmt.Sprintf("%s\n%s", "*", msg) } func PingHandler(s ircx.Sender, m *irc.Message) { @@ -133,8 +134,9 @@ func HandleMessage(m *irc.Message) { } switch tok[0] { case "!version": - //sayCh <- fmt.Sprintf("%s\n\001ACTION running on %s", "*", SoftwareInfo()) - sayCh <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo()) + msg := ctcp.Encode(ctcp.ACTION, fmt.Sprintf("running on %s", SoftwareInfo())) + sayCh <- fmt.Sprintf("%s\n%s", "*", msg) + //sayCh <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo()) default: } }