Add initial listplayers
Some checks are pending
CI / build (push) Waiting to run

This commit is contained in:
Dustin Pianalto 2021-02-24 14:01:20 -09:00
parent 1fbe5ca7bf
commit fb5f508fdf
2 changed files with 14 additions and 1 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/gorcon/rcon" "github.com/gorcon/rcon"
) )
var listplayersCommand = &disgoman.Command{ var ListplayersCommand = &disgoman.Command{
Name: "request", Name: "request",
Aliases: nil, Aliases: nil,
Description: "Submit a request for the guild staff", Description: "Submit a request for the guild staff",
@ -44,7 +44,18 @@ func listplayersCommandFunc(ctx disgoman.Context, args []string) {
for _, server := range servers { for _, server := range servers {
go listplayers(ctx, server) go listplayers(ctx, server)
} }
return
} }
serverName := strings.Join(args, " ")
server, err := services.ServerService.ServerByName(serverName, guild)
if err != nil {
discord_utils.SendErrorMessage(ctx,
fmt.Sprintf("Could not find **%s** in this guild.", serverName),
err,
)
return
}
listplayers(ctx, server)
} }
func listplayers(ctx disgoman.Context, server geeksbot.Server) { func listplayers(ctx disgoman.Context, server geeksbot.Server) {

View File

@ -2,6 +2,7 @@ package exts
import ( import (
"github.com/dustinpianalto/disgoman" "github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/geeksbot/internal/exts/arcon"
"github.com/dustinpianalto/geeksbot/internal/exts/guild" "github.com/dustinpianalto/geeksbot/internal/exts/guild"
"github.com/dustinpianalto/geeksbot/internal/exts/requests" "github.com/dustinpianalto/geeksbot/internal/exts/requests"
"github.com/dustinpianalto/geeksbot/internal/exts/utils" "github.com/dustinpianalto/geeksbot/internal/exts/utils"
@ -36,4 +37,5 @@ func AddCommandHandlers(g *disgoman.CommandManager) {
_ = g.AddCommand(requests.ListCommand) _ = g.AddCommand(requests.ListCommand)
_ = g.AddCommand(requests.ViewCommand) _ = g.AddCommand(requests.ViewCommand)
_ = g.AddCommand(requests.CommentCommand) _ = g.AddCommand(requests.CommentCommand)
_ = g.AddCommand(arcon.ListplayersCommand)
} }