Some renames
This commit is contained in:
		@ -1,4 +1,4 @@
 | 
				
			|||||||
package bot
 | 
					package kicker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	tb "gopkg.in/tucnak/telebot.v3"
 | 
						tb "gopkg.in/tucnak/telebot.v3"
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package bot
 | 
					package kicker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
@ -13,12 +13,14 @@ type Handler struct {
 | 
				
			|||||||
	Handler  tb.HandlerFunc
 | 
						Handler  tb.HandlerFunc
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Bot struct {
 | 
					/// Базовая структура для бота
 | 
				
			||||||
 | 
					type Kicker struct {
 | 
				
			||||||
	Bot   *tb.Bot
 | 
						Bot   *tb.Bot
 | 
				
			||||||
	Token string
 | 
						Token string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (b *Bot) Init() error {
 | 
					/// Initialize bot with token
 | 
				
			||||||
 | 
					func (b *Kicker) Init() error {
 | 
				
			||||||
	bot, err := tb.NewBot(tb.Settings{
 | 
						bot, err := tb.NewBot(tb.Settings{
 | 
				
			||||||
		Token:  b.Token,
 | 
							Token:  b.Token,
 | 
				
			||||||
		Poller: &tb.LongPoller{Timeout: 10 * time.Second},
 | 
							Poller: &tb.LongPoller{Timeout: 10 * time.Second},
 | 
				
			||||||
@ -32,7 +34,7 @@ func (b *Bot) Init() error {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Add handler methods to the bot
 | 
					// Add handler methods to the bot
 | 
				
			||||||
func (b *Bot) AddHandlers(handlers []Handler) error {
 | 
					func (b *Kicker) AddHandlers(handlers []Handler) error {
 | 
				
			||||||
	if len(handlers) != 0 {
 | 
						if len(handlers) != 0 {
 | 
				
			||||||
		for i := range handlers {
 | 
							for i := range handlers {
 | 
				
			||||||
			b.Bot.Handle(handlers[i].Endpoint, handlers[i].Handler)
 | 
								b.Bot.Handle(handlers[i].Endpoint, handlers[i].Handler)
 | 
				
			||||||
@ -4,7 +4,7 @@ import (
 | 
				
			|||||||
	"log"
 | 
						"log"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"godotkicker/bot"
 | 
						"kickerbot/kicker"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
@ -13,10 +13,8 @@ func main() {
 | 
				
			|||||||
		log.Fatal("no token specified")
 | 
							log.Fatal("no token specified")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Bot := bot.Bot{Token: token}
 | 
						Bot := kicker.Kicker{Token: token}
 | 
				
			||||||
	Bot.Init()
 | 
						Bot.Init()
 | 
				
			||||||
	Bot.AddHandlers(bot.HandlersV1)
 | 
						Bot.AddHandlers(kicker.HandlersV1)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	log.Print("successfuly launched")
 | 
					 | 
				
			||||||
	Bot.Bot.Start()
 | 
						Bot.Bot.Start()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user