rework services and add test command
This commit is contained in:
@@ -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, "✅")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user