Initialize services

This commit is contained in:
Dustin Pianalto
2021-01-23 03:11:12 -09:00
parent e2f97afa6d
commit ccfecd0965
6 changed files with 52 additions and 31 deletions
+13 -1
View File
@@ -17,8 +17,8 @@ var (
UserService userService
ChannelService channelService
MessageService messageService
PatreonService patreonService
RequestService requestService
PatreonService patreonService
ServerService serverService
)
@@ -52,4 +52,16 @@ func ConnectDatabase(dbConnString string) {
log.Fatal(err)
}
log.Println("Migrations Run")
initServices()
log.Println("Services Initialized")
}
func initServices() {
GuildService = guildService{db: db}
UserService = userService{db: db}
ChannelService = channelService{db: db}
MessageService = messageService{db: db}
PatreonService = patreonService{db: db}
RequestService = requestService{db: db}
ServerService = serverService{db: db}
}
+7 -7
View File
@@ -1,11 +1,11 @@
package exts
import (
"github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/geeksbot"
"github.com/dustinpianalto/geeksbot/internal/exts/utils"
)
func AddCommandHandlers(h *disgoman.CommandManager) {
func AddCommandHandlers(g *geeksbot.Geeksbot) {
// Arguments:
// name - command name - string
// desc - command description - string
@@ -14,9 +14,9 @@ func AddCommandHandlers(h *disgoman.CommandManager) {
// perms - permissisions required - anpan.Permission (int)
// type - command type, sets where the command is available
// run - function to run - func(anpan.Context, []string) / CommandRunFunc
_ = h.AddCommand(utils.UserCommand)
_ = h.AddCommand(utils.SayCommand)
_ = h.AddCommand(utils.GitCommand)
_ = h.AddCommand(utils.InviteCommand)
_ = h.AddCommand(utils.PingCommand)
_ = g.AddCommand(utils.UserCommand)
_ = g.AddCommand(utils.SayCommand)
_ = g.AddCommand(utils.GitCommand)
_ = g.AddCommand(utils.InviteCommand)
_ = g.AddCommand(utils.PingCommand)
}