rework services and add test command
CI / build (push) Has been cancelled

This commit is contained in:
Dustin Pianalto
2021-01-23 03:53:34 -09:00
parent 9724f77c8e
commit 12f5b43f35
5 changed files with 68 additions and 32 deletions
+33
View File
@@ -9,7 +9,9 @@ import (
"github.com/bwmarrin/discordgo"
"github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/geeksbot"
"github.com/dustinpianalto/geeksbot/internal/discord_utils"
"github.com/dustinpianalto/geeksbot/internal/services"
)
var PingCommand = &disgoman.Command{
@@ -246,3 +248,34 @@ func userCommandFunc(ctx disgoman.Context, args []string) {
}
}
}
var AddUserCommand = &disgoman.Command{
Name: "user",
Aliases: nil,
Description: "Get user info",
OwnerOnly: false,
Hidden: false,
RequiredPermissions: 0,
Invoke: addUserCommandFunc,
}
func addUserCommandFunc(ctx disgoman.Context, args []string) {
if ctx.Message.Author.ID == ctx.CommandManager.Owners[0] {
user := geeksbot.User{
ID: ctx.Message.Author.ID,
IsActive: true,
IsStaff: true,
IsAdmin: true,
}
user, err := services.UserService.CreateUser(user)
if err != nil {
ctx.CommandManager.ErrorChannel <- disgoman.CommandError{
Context: ctx,
Message: "Error with adding user",
Error: err,
}
return
}
ctx.Session.MessageReactionAdd(ctx.Channel.ID, ctx.Message.ID, "✅")
}
}