Some renames

This commit is contained in:
2021-12-03 14:30:10 +03:00
parent 9744337c99
commit 8e06d4c1c9
4 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
module godotkicker
module kickerbot
go 1.17
+1 -1
View File
@@ -1,4 +1,4 @@
package bot
package kicker
import (
tb "gopkg.in/tucnak/telebot.v3"
+6 -4
View File
@@ -1,4 +1,4 @@
package bot
package kicker
import (
"errors"
@@ -13,12 +13,14 @@ type Handler struct {
Handler tb.HandlerFunc
}
type Bot struct {
/// Базовая структура для бота
type Kicker struct {
Bot *tb.Bot
Token string
}
func (b *Bot) Init() error {
/// Initialize bot with token
func (b *Kicker) Init() error {
bot, err := tb.NewBot(tb.Settings{
Token: b.Token,
Poller: &tb.LongPoller{Timeout: 10 * time.Second},
@@ -32,7 +34,7 @@ func (b *Bot) Init() error {
}
// Add handler methods to the bot
func (b *Bot) AddHandlers(handlers []Handler) error {
func (b *Kicker) AddHandlers(handlers []Handler) error {
if len(handlers) != 0 {
for i := range handlers {
b.Bot.Handle(handlers[i].Endpoint, handlers[i].Handler)
+3 -5
View File
@@ -4,7 +4,7 @@ import (
"log"
"os"
"godotkicker/bot"
"kickerbot/kicker"
)
func main() {
@@ -13,10 +13,8 @@ func main() {
log.Fatal("no token specified")
}
Bot := bot.Bot{Token: token}
Bot := kicker.Kicker{Token: token}
Bot.Init()
Bot.AddHandlers(bot.HandlersV1)
log.Print("successfuly launched")
Bot.AddHandlers(kicker.HandlersV1)
Bot.Bot.Start()
}