From 9f66f93641612028455c43478da2b19e8ee42b8a Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 25 Nov 2018 19:32:16 +0100 Subject: Add option to send RAW commands after connection (irc). Fixes #490 (#604) --- bridge/irc/irc.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bridge/irc') diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index eee432b2..1e813246 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -365,6 +365,7 @@ func (b *Birc) handleOther(client *girc.Client, event girc.Event) { func (b *Birc) handleOtherAuth(client *girc.Client, event girc.Event) { b.handleNickServ() + b.handleRunCommands() // we are now fully connected b.connected <- nil } @@ -471,6 +472,15 @@ func (b *Birc) formatnicks(nicks []string) string { return strings.Join(nicks, ", ") + " currently on IRC" } +func (b *Birc) handleRunCommands() { + for _, cmd := range b.GetStringSlice("RunCommands") { + if err := b.i.Cmd.SendRaw(cmd); err != nil { + b.Log.Errorf("RunCommands %s failed: %s", cmd, err) + } + time.Sleep(time.Second) + } +} + func (b *Birc) handleNickServ() { if !b.GetBool("UseSASL") && b.GetString("NickServNick") != "" && b.GetString("NickServPassword") != "" { b.Log.Debugf("Sending identify to nickserv %s", b.GetString("NickServNick")) -- cgit v1.2.3