Skip to content

Commit

Permalink
Fix CA2021
Browse files Browse the repository at this point in the history
  • Loading branch information
Manu098vm committed Nov 19, 2024
1 parent e84723f commit 7522eb3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions SysBot.Pokemon.Discord/Commands/Management/BotModule.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Discord;
using Discord;
using Discord.Commands;
using PKHeX.Core;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SysBot.Pokemon.Discord;
Expand All @@ -15,16 +14,19 @@ namespace SysBot.Pokemon.Discord;
public async Task GetStatusAsync()
{
var me = SysCord<T>.Runner;
var bots = me.Bots.Select(z => z.Bot).OfType<PokeRoutineExecutorBase>().ToArray();
if (bots.Length == 0)
var sb = new StringBuilder();
foreach (var bot in me.Bots)
{
if (bot.Bot is not PokeRoutineExecutorBase b)
continue;
sb.AppendLine(GetDetailedSummary(b));
}
if (sb.Length == 0)
{
await ReplyAsync("No bots configured.").ConfigureAwait(false);
return;
}

var summaries = bots.Select(GetDetailedSummary);
var lines = string.Join(Environment.NewLine, summaries);
await ReplyAsync(Format.Code(lines)).ConfigureAwait(false);
await ReplyAsync(Format.Code(sb.ToString())).ConfigureAwait(false);
}

private static string GetDetailedSummary(PokeRoutineExecutorBase z)
Expand Down

0 comments on commit 7522eb3

Please sign in to comment.