some fixes
This commit is contained in:
parent
f203e3e056
commit
8f96244634
13
bot.go
13
bot.go
@ -6,20 +6,19 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"scurotgbot/utils"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Bot struct {
|
type Bot struct {
|
||||||
token string
|
token string
|
||||||
logger *utils.Logger
|
logger *Logger
|
||||||
debug bool
|
debug bool
|
||||||
|
|
||||||
plugins []*Plugin
|
plugins []*Plugin
|
||||||
prefixes []string
|
prefixes []string
|
||||||
|
|
||||||
updateOffset int
|
updateOffset int
|
||||||
updateQueue *utils.Queue[*Update]
|
updateQueue *Queue[*Update]
|
||||||
}
|
}
|
||||||
|
|
||||||
type MsgContext struct {
|
type MsgContext struct {
|
||||||
@ -31,9 +30,9 @@ type MsgContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewBot(token string) *Bot {
|
func NewBot(token string) *Bot {
|
||||||
logger := utils.Create()
|
logger := CreateLogger()
|
||||||
logger.SetLevel(utils.DEBUG)
|
logger.SetLevel(DEBUG)
|
||||||
updateQueue := utils.CreateQueue[*Update](256)
|
updateQueue := CreateQueue[*Update](256)
|
||||||
bot := &Bot{
|
bot := &Bot{
|
||||||
updateOffset: 0, plugins: make([]*Plugin, 0), debug: false,
|
updateOffset: 0, plugins: make([]*Plugin, 0), debug: false,
|
||||||
prefixes: make([]string, 0),
|
prefixes: make([]string, 0),
|
||||||
@ -124,7 +123,7 @@ func (b *Bot) SetDebug(debug bool) {
|
|||||||
b.debug = debug
|
b.debug = debug
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bot) GetQueue() *utils.Queue[*Update] {
|
func (b *Bot) GetQueue() *Queue[*Update] {
|
||||||
return b.updateQueue
|
return b.updateQueue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ var methodLevelMap = map[string]LogLevel{
|
|||||||
"get": GET, "post": POST, "put": PUT, "delete": DELETE,
|
"get": GET, "post": POST, "put": PUT, "delete": DELETE,
|
||||||
}
|
}
|
||||||
|
|
||||||
func Create() *Logger {
|
func CreateLogger() *Logger {
|
||||||
return &Logger{
|
return &Logger{
|
||||||
prefix: "LOG",
|
prefix: "LOG",
|
||||||
level: FATAL,
|
level: FATAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user