some fixes

This commit is contained in:
ScuroNeko 2024-12-16 00:56:15 +03:00
parent f203e3e056
commit 8f96244634
Signed by: ScuroNeko
GPG Key ID: C9081BDABF0837CA
2 changed files with 7 additions and 8 deletions

13
bot.go
View File

@ -6,20 +6,19 @@ import (
"fmt"
"io"
"net/http"
"scurotgbot/utils"
"strings"
)
type Bot struct {
token string
logger *utils.Logger
logger *Logger
debug bool
plugins []*Plugin
prefixes []string
updateOffset int
updateQueue *utils.Queue[*Update]
updateQueue *Queue[*Update]
}
type MsgContext struct {
@ -31,9 +30,9 @@ type MsgContext struct {
}
func NewBot(token string) *Bot {
logger := utils.Create()
logger.SetLevel(utils.DEBUG)
updateQueue := utils.CreateQueue[*Update](256)
logger := CreateLogger()
logger.SetLevel(DEBUG)
updateQueue := CreateQueue[*Update](256)
bot := &Bot{
updateOffset: 0, plugins: make([]*Plugin, 0), debug: false,
prefixes: make([]string, 0),
@ -124,7 +123,7 @@ func (b *Bot) SetDebug(debug bool) {
b.debug = debug
}
func (b *Bot) GetQueue() *utils.Queue[*Update] {
func (b *Bot) GetQueue() *Queue[*Update] {
return b.updateQueue
}

View File

@ -51,7 +51,7 @@ var methodLevelMap = map[string]LogLevel{
"get": GET, "post": POST, "put": PUT, "delete": DELETE,
}
func Create() *Logger {
func CreateLogger() *Logger {
return &Logger{
prefix: "LOG",
level: FATAL,