[Raid] Add test message commands

This commit is contained in:
2022-11-28 23:32:18 +01:00
parent 24fc0103ec
commit e853583371
2 changed files with 54 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ namespace Cocotte.Modules.Raids;
[Group("raid", "Raid related commands")]
[SuppressMessage("Performance", "CA1822:Mark members as static")]
public class RaidModule : InteractionModuleBase<SocketInteractionContext>
public partial class RaidModule : InteractionModuleBase<SocketInteractionContext>
{
private readonly ILogger<RaidModule> _logger;
private readonly IRaidsRepository _raids;

View File

@@ -0,0 +1,53 @@
using Cocotte.Utils;
using Discord;
using Discord.Interactions;
namespace Cocotte.Modules.Raids;
#if DEBUG
public partial class RaidModule
{
[MessageCommand("Add dps")]
public async Task AddDps(IMessage message)
{
await AddTestPlayer(message, PlayerRole.Dps);
}
[MessageCommand("Add tank")]
public async Task AddTank(IMessage message)
{
await AddTestPlayer(message, PlayerRole.Tank);
}
[MessageCommand("Add healer")]
public async Task AddHealer(IMessage message)
{
await AddTestPlayer(message, PlayerRole.Healer);
}
private async Task AddTestPlayer(IMessage message, PlayerRole playerRole)
{
if (message is IUserMessage userMessage && userMessage.Author.IsBot)
{
if (_raids.TryGetRaid(userMessage.Id, out var raid))
{
raid.AddPlayer(new RosterPlayer(
(ulong) Random.Shared.NextInt64(),
$"Player{Random.Shared.Next(1, 100)}",
playerRole,
(uint) (1000 * Random.Shared.Next(30, 60)),
Random.Shared.Next(0, 2) == 0)
);
await UpdateRaidRosterEmbed(raid);
}
}
await RespondAsync(
embed: EmbedUtils.SuccessEmbed($"Successfully added a {playerRole} player").Build(),
ephemeral: true
);
}
}
#endif