feat: leveling system

This commit is contained in:
2026-03-17 15:17:36 +00:00
parent 0354fdc032
commit 2bce787c05
24 changed files with 1840 additions and 3 deletions
+10 -2
View File
@@ -3,6 +3,8 @@ package bot
import (
"log"
"velox-bot/internal/commands"
"velox-bot/internal/db/services"
"velox-bot/internal/events"
"github.com/bwmarrin/discordgo"
)
@@ -13,9 +15,10 @@ type Bot struct {
GuildID string
Commands []*discordgo.ApplicationCommand
registeredCommands []*discordgo.ApplicationCommand
Services *services.Services
}
func NewBot(token, appID, guildID string, cmds []*discordgo.ApplicationCommand) (*Bot, error) {
func NewBot(token, appID, guildID string, cmds []*discordgo.ApplicationCommand, services *services.Services) (*Bot, error) {
session, err := discordgo.New("Bot " + token)
if err != nil {
return nil, err
@@ -26,6 +29,7 @@ func NewBot(token, appID, guildID string, cmds []*discordgo.ApplicationCommand)
AppID: appID,
GuildID: guildID,
Commands: cmds,
Services: services,
}, nil
}
@@ -45,8 +49,12 @@ func (b *Bot) Start() error {
}
b.Session.AddHandler(commands.HandleInteraction)
return nil
b.Session.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) {
events.HandleMessageCreate(s, m, b.Services)
})
return nil
}
func (b *Bot) Close() error {