Working with Go's Style Guide
This commit is contained in:
parent
216cb5d62d
commit
3266cc0f7e
20
bot.go
20
bot.go
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/thoj/go-ircevent"
|
|
||||||
"strings"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/thoj/go-ircevent"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Bot struct {
|
type Bot struct {
|
||||||
@ -51,7 +51,13 @@ var argmap = map[string]int{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fillCharmap(nick string, cat string, item string, val string) {
|
func fillCharmap(nick string, cat string, item string, val string) {
|
||||||
charmap = map[string]map[string]map[string]string { nick: map[string]map[string]string{ cat: map[string]string{ item: val, }, }, }
|
charmap = map[string]map[string]map[string]string{
|
||||||
|
nick: map[string]map[string]string{
|
||||||
|
cat: map[string]string{
|
||||||
|
item: val,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bot) Command(nick string, msg string) {
|
func (b *Bot) Command(nick string, msg string) {
|
||||||
@ -71,7 +77,9 @@ func (b *Bot) Command(nick string, msg string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if argmap[strings.Split(msg, " ")[0]] != len(args) { return }
|
if argmap[strings.Split(msg, " ")[0]] != len(args) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Check if mode is enabled and if command can be applied.
|
// TODO: Check if mode is enabled and if command can be applied.
|
||||||
|
|
||||||
@ -145,7 +153,9 @@ func (b *Bot) Say(msg string) {
|
|||||||
func (b *Bot) Listen() {
|
func (b *Bot) Listen() {
|
||||||
err := b.Conn.Connect(b.Server)
|
err := b.Conn.Connect(b.Server)
|
||||||
|
|
||||||
if err != nil { panic(err) }
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
b.Conn.AddCallback("001", func(e *irc.Event) {
|
b.Conn.AddCallback("001", func(e *irc.Event) {
|
||||||
b.Conn.Join(b.Channel)
|
b.Conn.Join(b.Channel)
|
||||||
|
Loading…
Reference in New Issue
Block a user