aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-11-03 17:06:51 +0000
committerterminaldweller <devi@terminaldweller.com>2024-11-03 17:07:33 +0000
commit5c527d516d424edc72f7882cf4154de85698173b (patch)
treea28cb11823336ff042fcae558dc75da2ba3ee2b1 /main.go
parentreadme update (diff)
downloadsms-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.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/main.go b/main.go
index 0b3a60c..0611524 100644
--- a/main.go
+++ b/main.go
@@ -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) {})