This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package exts
|
||||
|
||||
import (
|
||||
"github.com/dustinpianalto/geeksbot"
|
||||
"github.com/dustinpianalto/disgoman"
|
||||
"github.com/dustinpianalto/geeksbot/internal/exts/utils"
|
||||
)
|
||||
|
||||
func AddCommandHandlers(g *geeksbot.Geeksbot) {
|
||||
func AddCommandHandlers(g *disgoman.CommandManager) {
|
||||
// Arguments:
|
||||
// name - command name - string
|
||||
// desc - command description - string
|
||||
@@ -15,6 +15,7 @@ func AddCommandHandlers(g *geeksbot.Geeksbot) {
|
||||
// type - command type, sets where the command is available
|
||||
// run - function to run - func(anpan.Context, []string) / CommandRunFunc
|
||||
_ = g.AddCommand(utils.UserCommand)
|
||||
_ = g.AddCommand(utils.AddUserCommand)
|
||||
_ = g.AddCommand(utils.SayCommand)
|
||||
_ = g.AddCommand(utils.GitCommand)
|
||||
_ = g.AddCommand(utils.InviteCommand)
|
||||
|
||||
@@ -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