Compare commits
No commits in common. "2cd84df2babb751c2e8bc8e279bee8cfa3c4464b" and "fd022bddfd8fca8222acf668038da242694a8da2" have entirely different histories.
2cd84df2ba
...
fd022bddfd
6 changed files with 114 additions and 122 deletions
53
boddle.go
53
boddle.go
|
|
@ -1,19 +1,21 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
"fmt"
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"math/rand"
|
|
||||||
"net"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"database/sql"
|
||||||
|
"math/rand"
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var begin_char = []byte{'-'}
|
var begin_char = []byte{'-'}
|
||||||
|
var db *sql.DB
|
||||||
|
var err error
|
||||||
|
|
||||||
|
|
||||||
// function to split advise message correctly
|
// function to split advise message correctly
|
||||||
func filter(msg string, conn net.Conn, db *sql.DB, nickname string) cmd {
|
func filter(msg string, foo bot) cmd {
|
||||||
var c cmd
|
var c cmd
|
||||||
|
|
||||||
if len(msg) <= 0 {
|
if len(msg) <= 0 {
|
||||||
|
|
@ -32,7 +34,7 @@ func filter(msg string, conn net.Conn, db *sql.DB, nickname string) cmd {
|
||||||
c.add = false
|
c.add = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(msg, "[") && strings.Contains(msg, "]") {
|
if (strings.Contains(msg, "[") && strings.Contains(msg, "]")) {
|
||||||
re, _ := regexp.Compile(`\s*(\w*)\s*\[(.+)\]\s*(.*)\s*`)
|
re, _ := regexp.Compile(`\s*(\w*)\s*\[(.+)\]\s*(.*)\s*`)
|
||||||
res := re.FindStringSubmatch(msg)
|
res := re.FindStringSubmatch(msg)
|
||||||
if len(res) < 4 {
|
if len(res) < 4 {
|
||||||
|
|
@ -64,7 +66,7 @@ func filter(msg string, conn net.Conn, db *sql.DB, nickname string) cmd {
|
||||||
c.groups = append(c.groups, fmt.Sprintf("%d", group_id))
|
c.groups = append(c.groups, fmt.Sprintf("%d", group_id))
|
||||||
} else {
|
} else {
|
||||||
if c.add {
|
if c.add {
|
||||||
c.groups = append(c.groups, addgroups(db, []string{group}, nil)...)
|
c.groups = append(c.groups, addgroups([]string{group}, nil)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|
@ -108,7 +110,7 @@ func getRandomEntry(c cmd) string {
|
||||||
return task
|
return task
|
||||||
}
|
}
|
||||||
|
|
||||||
func addgroups(db *sql.DB, new_groups []string, msg *irc_msg) []string {
|
func addgroups(new_groups []string, msg *irc_msg) []string {
|
||||||
stat_sel, err := db.Prepare("select id from groups where name = ?")
|
stat_sel, err := db.Prepare("select id from groups where name = ?")
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
stat_ins, err := db.Prepare("insert into groups(name) values (?)")
|
stat_ins, err := db.Prepare("insert into groups(name) values (?)")
|
||||||
|
|
@ -139,7 +141,7 @@ func addgroups(db *sql.DB, new_groups []string, msg *irc_msg) []string {
|
||||||
return groupids_added
|
return groupids_added
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkSorter(db *sql.DB, msg *irc_msg, c *cmd) bool {
|
func checkSorter(msg *irc_msg, c *cmd) bool {
|
||||||
sorter_row_sel, err := db.Prepare("select id, tag_id, groups_allow, name_allow, has_groups from sorter where name = ?")
|
sorter_row_sel, err := db.Prepare("select id, tag_id, groups_allow, name_allow, has_groups from sorter where name = ?")
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
sorter_row, err := sorter_row_sel.Query((*c).cmd)
|
sorter_row, err := sorter_row_sel.Query((*c).cmd)
|
||||||
|
|
@ -168,7 +170,7 @@ func checkSorter(db *sql.DB, msg *irc_msg, c *cmd) bool {
|
||||||
group_sel, err := db.Prepare("select group_id from sorter_groups where sorter_id = ?")
|
group_sel, err := db.Prepare("select group_id from sorter_groups where sorter_id = ?")
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
sorter_groups_row, err := group_sel.Query(sorter_id)
|
sorter_groups_row, err := group_sel.Query(sorter_id)
|
||||||
//sorter_groups_row, err := foo.db.Query(fmt.Sprintf("select group_id from sorter_groups where sorter_id = '%s'", sorter_id))
|
//sorter_groups_row, err := db.Query(fmt.Sprintf("select group_id from sorter_groups where sorter_id = '%s'", sorter_id))
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
if sorter_groups_row.Next() {
|
if sorter_groups_row.Next() {
|
||||||
var group_id int
|
var group_id int
|
||||||
|
|
@ -197,7 +199,7 @@ func checkSorter(db *sql.DB, msg *irc_msg, c *cmd) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func chooseEntry(db *sql.DB, msg *irc_msg, c *cmd) {
|
func chooseEntry(msg *irc_msg, c *cmd) {
|
||||||
task := getRandomEntry(*c)
|
task := getRandomEntry(*c)
|
||||||
|
|
||||||
LOG_INFO.Printf(task)
|
LOG_INFO.Printf(task)
|
||||||
|
|
@ -216,7 +218,7 @@ func chooseEntry(db *sql.DB, msg *irc_msg, c *cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func addLine(db *sql.DB, msg *irc_msg, line string, groups []string, cmd string) string {
|
func addLine(msg *irc_msg, line string, groups []string, cmd string) string {
|
||||||
LOG_WARN.Printf("adding new stuff: %s from %s.\n", line, (*msg).author)
|
LOG_WARN.Printf("adding new stuff: %s from %s.\n", line, (*msg).author)
|
||||||
|
|
||||||
res, err := db.Exec("insert into line (content, author) values (?,?)", line, (*msg).author)
|
res, err := db.Exec("insert into line (content, author) values (?,?)", line, (*msg).author)
|
||||||
|
|
@ -224,7 +226,7 @@ func addLine(db *sql.DB, msg *irc_msg, line string, groups []string, cmd string)
|
||||||
LOG_WARN.Printf("added line to table.\n")
|
LOG_WARN.Printf("added line to table.\n")
|
||||||
|
|
||||||
// get ID of content...
|
// get ID of content...
|
||||||
line_id, err := res.LastInsertId()
|
line_id, err := res.LastInsertId();
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
||||||
LOG_WARN.Printf("line_id: %d, tag_id: %s, groups: %s\n", line_id, cmd, strings.Join(groups, "-"))
|
LOG_WARN.Printf("line_id: %d, tag_id: %s, groups: %s\n", line_id, cmd, strings.Join(groups, "-"))
|
||||||
|
|
@ -247,11 +249,10 @@ func addLine(db *sql.DB, msg *irc_msg, line string, groups []string, cmd string)
|
||||||
(*msg).retmsg = fmt.Sprintf("success adding new super funny enjoyable line with ID %d!", line_id)
|
(*msg).retmsg = fmt.Sprintf("success adding new super funny enjoyable line with ID %d!", line_id)
|
||||||
return fmt.Sprintf("new line: > %s < (ID %d), into groups %s", line, line_id, strings.Join(groups,","))
|
return fmt.Sprintf("new line: > %s < (ID %d), into groups %s", line, line_id, strings.Join(groups,","))
|
||||||
}
|
}
|
||||||
|
|
||||||
// line:
|
// line:
|
||||||
// >befehl <[groups]> <name>
|
// >befehl <[groups]> <name>
|
||||||
// befehl ist genau ein wort
|
// befehl ist genau ein wort
|
||||||
func parsemsg(msg *irc_msg, conn net.Conn, db *sql.DB, nickname string) bool {
|
func parsemsg(msg *irc_msg, foo bot) bool {
|
||||||
if len((*msg).msg) <= 0 {
|
if len((*msg).msg) <= 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -264,7 +265,7 @@ func parsemsg(msg *irc_msg, conn net.Conn, db *sql.DB, nickname string) bool {
|
||||||
}
|
}
|
||||||
(*msg).msg = (*msg).msg[1:]
|
(*msg).msg = (*msg).msg[1:]
|
||||||
|
|
||||||
c := filter((*msg).msg, conn, db, nickname)
|
c := filter((*msg).msg, foo)
|
||||||
if !c.valid {
|
if !c.valid {
|
||||||
LOG_WARN.Printf("non valid input found.\n")
|
LOG_WARN.Printf("non valid input found.\n")
|
||||||
if c.error != "" {
|
if c.error != "" {
|
||||||
|
|
@ -283,7 +284,7 @@ func parsemsg(msg *irc_msg, conn net.Conn, db *sql.DB, nickname string) bool {
|
||||||
}
|
}
|
||||||
if c.cmd == "slap" {
|
if c.cmd == "slap" {
|
||||||
who := []string{(*msg).author, "\x01ACTION"}
|
who := []string{(*msg).author, "\x01ACTION"}
|
||||||
whom := []string{(*msg).author, nickname}
|
whom := []string{(*msg).author, foo.Conf.Name}
|
||||||
LOG_WARN.Printf("suffix: " + c.suffix)
|
LOG_WARN.Printf("suffix: " + c.suffix)
|
||||||
if c.suffix != "" {
|
if c.suffix != "" {
|
||||||
who = append(who, strings.Split(c.suffix, " ")...)
|
who = append(who, strings.Split(c.suffix, " ")...)
|
||||||
|
|
@ -294,28 +295,28 @@ func parsemsg(msg *irc_msg, conn net.Conn, db *sql.DB, nickname string) bool {
|
||||||
}
|
}
|
||||||
// hard code 'groups' to add new groups to the groups-table
|
// hard code 'groups' to add new groups to the groups-table
|
||||||
if c.add && (c.cmd == "groups" || c.cmd == "group") {
|
if c.add && (c.cmd == "groups" || c.cmd == "group") {
|
||||||
if c.groups != nil {
|
if (c.groups != nil) {
|
||||||
(*msg).retmsg = "Ignoring groups for the groups-adding. Well, what were you expecting...?"
|
(*msg).retmsg = "Ignoring groups for the groups-adding. Well, what were you expecting...?"
|
||||||
}
|
}
|
||||||
addgroups(db, strings.Fields((&c).suffix), msg)
|
addgroups(strings.Fields((&c).suffix), msg)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// have a look at sorter table if command is valid
|
// have a look at sorter table if command is valid
|
||||||
if !checkSorter(db, msg, &c) {
|
if !checkSorter(msg, &c) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// new line for database
|
// new line for database
|
||||||
if c.add {
|
if c.add {
|
||||||
// if there is nothing to add, just return. :-)
|
// if there is nothing to add, just return. :-)
|
||||||
if len(c.suffix) <= 0 {
|
if (len(c.suffix) <= 0) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
c.suffix = strings.Replace(c.suffix,"\"","'", -1)
|
c.suffix = strings.Replace(c.suffix,"\"","'", -1)
|
||||||
sendmsg(conn, "horscchtey", addLine(db, msg, c.suffix, c.groups, c.cmd))
|
sendmsg(foo.conn, "horscchtey", addLine(msg, c.suffix, c.groups, c.cmd))
|
||||||
} else {
|
} else {
|
||||||
chooseEntry(db, msg, &c)
|
chooseEntry(msg, &c)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
118
bot.go
118
bot.go
|
|
@ -1,14 +1,15 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"log"
|
||||||
"database/sql"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
"bufio"
|
||||||
|
"strings"
|
||||||
|
"database/sql"
|
||||||
|
configo "github.com/distributedio/configo"
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func sendmsg (conn net.Conn, channel string, msg string) {
|
func sendmsg (conn net.Conn, channel string, msg string) {
|
||||||
|
|
@ -35,30 +36,32 @@ func scanline_privmsg(msg string, irc *irc_msg) {
|
||||||
(*irc).retmsg = ""
|
(*irc).retmsg = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func bot_connect(server string) net.Conn {
|
func bot_connect(bot *bot) {
|
||||||
conn, err := net.Dial("tcp", server)
|
conn, err := net.Dial("tcp", (*bot).Conf.Server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LOG_ERR.Printf("Error while dialing server: %s.", server)
|
LOG_ERR.Printf("Error while dialing server.")
|
||||||
return nil
|
(*bot).conn = nil
|
||||||
}
|
return
|
||||||
return conn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func bot_register(conn net.Conn, nickname string, channels []string) {
|
(*bot).conn = conn
|
||||||
|
fmt.Fprintf((*bot).conn, "USER %s 1 1 1:%s\r\n", (*bot).Conf.Name, (*bot).Conf.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func bot_register(bot *bot) {
|
||||||
/* connect to irc */
|
/* connect to irc */
|
||||||
fmt.Fprintf(conn, "USER %s 1 1 1:%s\r\n", nickname, nickname)
|
fmt.Fprintf((*bot).conn, "NICK %s\r\n", (*bot).Conf.Name)
|
||||||
fmt.Fprintf(conn, "NICK %s\r\n", nickname)
|
for _, channel := range((*bot).Conf.Channels) {
|
||||||
for _, channel := range channels {
|
fmt.Fprintf((*bot).conn, "JOIN %s\r\n", channel)
|
||||||
fmt.Fprintf(conn, "JOIN %s\r\n", channel)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func bot_listen(conn net.Conn, db *sql.DB, nickname string, channels []string) <-chan string {
|
func bot_listen(bot *bot) <-chan string {
|
||||||
c := make(chan string)
|
c := make(chan string)
|
||||||
bot_register(conn, nickname, channels)
|
bot_register(bot)
|
||||||
|
|
||||||
go func(timeoutNormal time.Duration, timeoutVersion time.Duration) {
|
go func(timeoutNormal time.Duration, timeoutVersion time.Duration) {
|
||||||
bufReader := bufio.NewReader(conn)
|
bufReader := bufio.NewReader((*bot).conn)
|
||||||
|
|
||||||
timeoutDuration := timeoutNormal
|
timeoutDuration := timeoutNormal
|
||||||
waitversion := false
|
waitversion := false
|
||||||
|
|
@ -66,11 +69,11 @@ func bot_listen(conn net.Conn, db *sql.DB, nickname string, channels []string) <
|
||||||
defer func() {
|
defer func() {
|
||||||
fmt.Println("Closing connection...")
|
fmt.Println("Closing connection...")
|
||||||
close(c)
|
close(c)
|
||||||
conn.Close()
|
(*bot).conn.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
conn.SetReadDeadline(time.Now().Add(timeoutDuration))
|
(*bot).conn.SetReadDeadline(time.Now().Add(timeoutDuration))
|
||||||
|
|
||||||
line, err := bufReader.ReadString('\n')
|
line, err := bufReader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -81,7 +84,7 @@ func bot_listen(conn net.Conn, db *sql.DB, nickname string, channels []string) <
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err := conn.Write([]byte("VERSION\n"))
|
n, err := (*bot).conn.Write([]byte("VERSION\n"))
|
||||||
fmt.Printf("n: %d, err: %s\n", n, err)
|
fmt.Printf("n: %d, err: %s\n", n, err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Writing to channel failed.")
|
fmt.Println("Writing to channel failed.")
|
||||||
|
|
@ -103,19 +106,18 @@ func bot_listen(conn net.Conn, db *sql.DB, nickname string, channels []string) <
|
||||||
c <- line
|
c <- line
|
||||||
|
|
||||||
if strings.Contains(line, "PING") {
|
if strings.Contains(line, "PING") {
|
||||||
conn.Write([]byte(strings.Replace(line, "PING", "PONG", 1)))
|
(*bot).conn.Write([]byte(strings.Replace(line, "PING", "PONG", 1)))
|
||||||
} else if strings.Contains(line, "You have not registered") {
|
} else if strings.Contains(line, "You have not registered") {
|
||||||
// set nickname
|
// set nickname
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
bot_register(conn, nickname, channels)
|
bot_register(bot)
|
||||||
|
|
||||||
} else if strings.Contains(line, "PRIVMSG") {
|
} else if strings.Contains(line, "PRIVMSG") {
|
||||||
var msg irc_msg
|
var msg irc_msg
|
||||||
scanline_privmsg(line, &msg)
|
scanline_privmsg(line, &msg)
|
||||||
LOG_ERR.Printf(msg.author)
|
LOG_ERR.Printf(msg.author)
|
||||||
parsemsg(&msg, conn, db, nickname)
|
parsemsg(&msg, (*bot))
|
||||||
if msg.retmsg != "" {
|
if msg.retmsg != "" {
|
||||||
sendmsg(conn, msg.channel, msg.retmsg)
|
sendmsg((*bot).conn, msg.channel, msg.retmsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -124,72 +126,36 @@ func bot_listen(conn net.Conn, db *sql.DB, nickname string, channels []string) <
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func db_open(info string) *sql.DB {
|
func bot_run(bot *bot) {
|
||||||
LOG_INFO.Printf("Opening database: %s", info)
|
|
||||||
|
|
||||||
var db *sql.DB = nil
|
|
||||||
var err error
|
|
||||||
|
|
||||||
parts := strings.SplitN(info, ":", 2)
|
|
||||||
if len(parts) == 2 {
|
|
||||||
db, err = sql.Open(parts[0], parts[1])
|
|
||||||
} else {
|
|
||||||
db, err = sql.Open("sqlite3", info)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return db
|
|
||||||
}
|
|
||||||
|
|
||||||
func bot_run(server string, nickname string, database string, channels []string) {
|
|
||||||
LOG_INFO.Println("Bot ready to run.")
|
LOG_INFO.Println("Bot ready to run.")
|
||||||
|
|
||||||
db := db_open(database)
|
LOG_INFO.Println("Opening database.")
|
||||||
if db == nil {
|
db, err = sql.Open("sqlite3", (*bot).Conf.Database)
|
||||||
|
if err != nil {
|
||||||
LOG_ERR.Println("Opening database failed.")
|
LOG_ERR.Println("Opening database failed.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
conn := bot_connect(server)
|
bot_connect(bot)
|
||||||
if conn == nil {
|
if bot.conn == nil {
|
||||||
LOG_INFO.Printf("Bot is nil. Try to connect again.")
|
LOG_INFO.Printf("Bot is nil. Try to connect again.")
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
for val := range bot_listen(bot) {
|
||||||
for val := range bot_listen(conn, db, nickname, channels) {
|
|
||||||
LOG_INFO.Printf("%s", val)
|
LOG_INFO.Printf("%s", val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type stringList []string
|
|
||||||
|
|
||||||
func (i *stringList) String() string {
|
|
||||||
return fmt.Sprintf("%v", *i)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *stringList) Set(value string) error {
|
|
||||||
*i = append(*i, value)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
LOG_init()
|
LOG_init()
|
||||||
|
|
||||||
var channels stringList
|
var boddle bot
|
||||||
|
if err := configo.Load("./boddle.toml", &boddle.Conf); err != nil {
|
||||||
flag.Var(&channels, "channel", "channels to connect")
|
log.Fatal(err)
|
||||||
server := flag.String("server", "irc.ircnet.com:6667", "domain:port for irc-server")
|
}
|
||||||
nickname := flag.String("nick", "boddle", "nickname to use for bot")
|
|
||||||
database := flag.String("database", "./boddle.db", "database to use")
|
bot_run(&boddle)
|
||||||
|
|
||||||
flag.Parse()
|
|
||||||
LOG_INFO.Printf("server: %s", *server)
|
|
||||||
LOG_INFO.Printf("nick: %s", *nickname)
|
|
||||||
|
|
||||||
bot_run(*server, *nickname, *database, channels)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
conf.go
Normal file
8
conf.go
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type Boddle struct {
|
||||||
|
name string `cfg:"name; boddle; printableascii; IRC nick of bot"`
|
||||||
|
channels []string `cfg:"channels; required; printableascii; Channel list to join to"`
|
||||||
|
server string `cfg:"server; required; netaddr; Server name to connect to"`
|
||||||
|
database string `cfg:"database; ./boddle.db; path; Path to database"`
|
||||||
|
}
|
||||||
17
types.go
17
types.go
|
|
@ -1,5 +1,16 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
Name string `cfg:"name; boddle; printableascii; IRC nick of bot"`
|
||||||
|
Channels []string `cfg:"channels; required; printableascii; Channel list to join to"`
|
||||||
|
Server string `cfg:"server; required; netaddr; Server name to connect to"`
|
||||||
|
Database string `cfg:"database; ./boddle.db; path; Path to database"`
|
||||||
|
}
|
||||||
|
|
||||||
type irc_msg struct {
|
type irc_msg struct {
|
||||||
channel string
|
channel string
|
||||||
msg string
|
msg string
|
||||||
|
|
@ -15,3 +26,9 @@ type cmd struct {
|
||||||
suffix string
|
suffix string
|
||||||
error string
|
error string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type bot struct {
|
||||||
|
Conf Config
|
||||||
|
conn net.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue