Compare commits

...
3 Commits
Author SHA1 Message Date
Dustin Pianalto dddcc8c316 Update format on listplayers output
CI / build (push) Has been cancelled
2021-02-24 14:10:55 -09:00
Dustin Pianalto 5a384305b0 Add initial listplayers
CI / build (push) Has been cancelled
2021-02-24 14:06:18 -09:00
Dustin Pianalto fb5f508fdf Add initial listplayers
CI / build (push) Has been cancelled
2021-02-24 14:01:20 -09:00
2 changed files with 17 additions and 4 deletions
+15 -4
View File
@@ -11,10 +11,10 @@ import (
"github.com/gorcon/rcon"
)
var listplayersCommand = &disgoman.Command{
Name: "request",
var ListplayersCommand = &disgoman.Command{
Name: "listplayers",
Aliases: nil,
Description: "Submit a request for the guild staff",
Description: "List the players currently connected to a ARK server.",
OwnerOnly: false,
Hidden: false,
RequiredPermissions: 0,
@@ -44,7 +44,18 @@ func listplayersCommandFunc(ctx disgoman.Context, args []string) {
for _, server := range servers {
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) {
@@ -87,6 +98,6 @@ func listplayers(ctx disgoman.Context, server geeksbot.Server) {
}
}
_, _ = ctx.Session.ChannelMessageEdit(ctx.Channel.ID, msg.ID,
fmt.Sprintf("**%s:**\n%s", server.Name, strings.Join(players, "\n")),
fmt.Sprintf("**%s:**%s", server.Name, strings.Join(players, "\n")),
)
}
+2
View File
@@ -2,6 +2,7 @@ package exts
import (
"github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/geeksbot/internal/exts/arcon"
"github.com/dustinpianalto/geeksbot/internal/exts/guild"
"github.com/dustinpianalto/geeksbot/internal/exts/requests"
"github.com/dustinpianalto/geeksbot/internal/exts/utils"
@@ -36,4 +37,5 @@ func AddCommandHandlers(g *disgoman.CommandManager) {
_ = g.AddCommand(requests.ListCommand)
_ = g.AddCommand(requests.ViewCommand)
_ = g.AddCommand(requests.CommentCommand)
_ = g.AddCommand(arcon.ListplayersCommand)
}