diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-11-03 17:06:51 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-11-03 17:07:33 +0000 |
commit | 5c527d516d424edc72f7882cf4154de85698173b (patch) | |
tree | a28cb11823336ff042fcae558dc75da2ba3ee2b1 /main.go | |
parent | readme update (diff) | |
download | sms-webhook-5c527d516d424edc72f7882cf4154de85698173b.tar.gz sms-webhook-5c527d516d424edc72f7882cf4154de85698173b.zip |
added the ability to join channels with passwords, fixes #1
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -40,12 +40,13 @@ type SMS struct { } type TomlConfig struct { - IrcServer string - IrcPort int - IrcNick string - IrcSaslUser string - IrcSaslPass string - IrcChannel string + IrcServer string + IrcPort int + IrcNick string + IrcSaslUser string + IrcSaslPass string + IrcChannel string + IrcChannelPass string } // curl -X 'POST' 'http://127.0.0.1:8090/sms' -H 'content-type: application/json; charset=utf-8' -d $'{"from":"1234567890","text":"Test"}' @@ -114,7 +115,11 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { } irc.Handlers.AddBg(girc.CONNECTED, func(c *girc.Client, e girc.Event) { - c.Cmd.Join(appConfig.IrcChannel) + if appConfig.IrcChannelPass != "" { + c.Cmd.JoinKey(appConfig.IrcChannel, appConfig.IrcChannelPass) + } else { + c.Cmd.Join(appConfig.IrcChannel) + } }) // irc.Handlers.AddBg(girc.PRIVMSG, func(c *girc.Client, e girc.Event) {}) |