small cleanup of utility.cs

This commit is contained in:
Toastie (DCS Team) 2024-08-17 19:21:49 +12:00
parent 51bfe8d206
commit 05c03248c4
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -222,17 +222,7 @@ public partial class Utility : EllieModule
builder.AppendLine($"{p.Name} : {p.GetValue(perms, null)}"); builder.AppendLine($"{p.Name} : {p.GetValue(perms, null)}");
await Response().Confirm(builder.ToString()).SendAsync(); await Response().Confirm(builder.ToString()).SendAsync();
} }
// [Cmd]
// [RequireContext(ContextType.Guild)]
// [RequireUserPermission(GuildPermission.ManageRoles)]
// public async Task CheckPerms(SocketRole role, string perm = null)
// {
// ChannelPermissions.
// var perms = ((ITextChannel)ctx.Channel);
// await SendPerms(perms)
// }
[Cmd] [Cmd]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task UserId([Leftover] IGuildUser? target = null) public async Task UserId([Leftover] IGuildUser? target = null)
@ -337,31 +327,33 @@ public partial class Utility : EllieModule
if (string.IsNullOrWhiteSpace(ownerIds)) if (string.IsNullOrWhiteSpace(ownerIds))
ownerIds = "-"; ownerIds = "-";
var eb = _sender.CreateEmbed()
.WithOkColor()
.WithAuthor($"EllieBot v{StatsService.BotVersion}",
"https://cdn.elliebot.net/Ellie.png",
"https://docs.elliebot.net/")
.AddField(GetText(strs.author), _stats.Author, true)
.AddField(GetText(strs.botid), _client.CurrentUser.Id.ToString(), true)
.AddField(GetText(strs.shard),
$"#{_client.ShardId} / {_creds.TotalShards}",
true)
.AddField(GetText(strs.commands_ran), _stats.CommandsRan.ToString(), true)
.AddField(GetText(strs.messages),
$"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)",
true)
.AddField(GetText(strs.memory),
FormattableString.Invariant($"{_stats.GetPrivateMemoryMegabytes():F2} MB"),
true)
.AddField(GetText(strs.owner_ids), ownerIds, true)
.AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true)
.AddField(GetText(strs.presence),
GetText(strs.presence_txt(_coord.GetGuildCount(),
_stats.TextChannels,
_stats.VoiceChannels)),
true);
await Response() await Response()
.Embed(_sender.CreateEmbed() .Embed(eb)
.WithOkColor()
.WithAuthor($"EllieBot v{StatsService.BotVersion}",
"https://cdn.elliebot.net/Ellie.png",
"https://docs.elliebot.net/")
.AddField(GetText(strs.author), _stats.Author, true)
.AddField(GetText(strs.botid), _client.CurrentUser.Id.ToString(), true)
.AddField(GetText(strs.shard),
$"#{_client.ShardId} / {_creds.TotalShards}",
true)
.AddField(GetText(strs.commands_ran), _stats.CommandsRan.ToString(), true)
.AddField(GetText(strs.messages),
$"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)",
true)
.AddField(GetText(strs.memory),
FormattableString.Invariant($"{_stats.GetPrivateMemoryMegabytes():F2} MB"),
true)
.AddField(GetText(strs.owner_ids), ownerIds, true)
.AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true)
.AddField(GetText(strs.presence),
GetText(strs.presence_txt(_coord.GetGuildCount(),
_stats.TextChannels,
_stats.VoiceChannels)),
true))
.SendAsync(); .SendAsync();
} }