commit 61f0fd308c10d0494b679542d77ff09695da9c64
parent 6f7b49330da530b1b8a285d93e17b3e523ffaca7
Author: Emile "iMil" Heitor <imil@netbsd.org>
Date: Mon, 27 May 2024 06:02:50 +0000
Merge branch 'allow_query_target' into 'main'
Allow query as a "channel"
See merge request gcu-squad/gruik!4
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/main.go b/main.go
@@ -117,7 +117,8 @@ func newsFetch(client *girc.Client, channel string) {
}
for {
- if client.IsConnected() && len(client.ChannelList()) != 0 {
+ // Only check chanlist if target is not a query
+ if client.IsConnected() && (!strings.HasPrefix(channel, "#") || len(client.ChannelList()) != 0) {
break
}
log.Printf("%v, not connected, waiting...\n", client.ChannelList())
@@ -298,11 +299,15 @@ func main() {
}
client.Handlers.Add(girc.CONNECTED, func(c *girc.Client, e girc.Event) {
- c.Cmd.Join(channel)
+ if strings.HasPrefix(channel, "#") {
+ c.Cmd.Join(channel)
+ }
// join secondary channels for xposting
for _, xchan := range viper.GetStringSlice("irc.xchannels") {
- c.Cmd.Join(xchan)
+ if strings.HasPrefix(xchan, "#") {
+ c.Cmd.Join(xchan)
+ }
}
})
client.Handlers.Add(girc.PRIVMSG, func(c *girc.Client, e girc.Event) {