mirror of
https://gitlab.com/prokop_paruzek/botik.git
synced 2025-12-19 06:17:56 +01:00
print debug messages
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user