print debug messages

This commit is contained in:
2022-08-19 16:26:06 +02:00
parent 4c63d27acb
commit 034d473ea0

View File

@@ -3,8 +3,10 @@ package main
import (
"bufio"
"crypto/tls"
"flag"
"fmt"
"io"
"os"
"os/exec"
"strings"
@@ -37,6 +39,10 @@ func sendMultiline(conn io.Writer, msg string, receiver string) {
}
func main() {
// flags parse
var debug bool
flag.BoolVar(&debug, "D", false, "Print debug messages.")
flag.Parse()
// IRC init
conn, err := tls.Dial("tcp", host, &tls.Config{RootCAs: nil})
if err != nil {
@@ -55,6 +61,9 @@ func main() {
for {
in, _ := reader.ReadString('\n')
words := strings.Fields(in)
if debug {
fmt.Fprintln(os.Stderr, words)
}
who := strings.Split(words[0], "!")[0][1:]
if who == "botik" {
continue