mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-01 11:39:55 +03:00
another two or three refactors
This commit is contained in:
parent
868b6bcaa7
commit
790f77aa49
21 changed files with 1447 additions and 944 deletions
|
@ -1,30 +1,22 @@
|
|||
using Discord.Commands;
|
||||
|
||||
// ReSharper disable UnusedType.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
using Humanizer;
|
||||
|
||||
namespace Boyfriend.Commands;
|
||||
|
||||
public class HelpCommand : Command {
|
||||
public override async Task Run(SocketCommandContext context, string[] args) {
|
||||
var nl = Environment.NewLine;
|
||||
var prefix = Boyfriend.GetGuildConfig(context.Guild).Prefix;
|
||||
var toSend = string.Format(Messages.CommandHelp, nl);
|
||||
public override string[] Aliases { get; } = {"help", "помощь", "справка"};
|
||||
public override int ArgsLengthRequired => 0;
|
||||
|
||||
toSend = CommandHandler.Commands.Aggregate(toSend,
|
||||
(current, command) => current + $"`{prefix}{command.GetAliases()[0]}`: {command.GetSummary()}{nl}");
|
||||
await context.Channel.SendMessageAsync(toSend);
|
||||
}
|
||||
public override Task Run(SocketCommandContext context, string[] args) {
|
||||
var prefix = Boyfriend.GetGuildConfig(context.Guild.Id)["Prefix"];
|
||||
var toSend = Boyfriend.StringBuilder.Append(Messages.CommandHelp);
|
||||
|
||||
public override List<string> GetAliases() {
|
||||
return new List<string> {"help", "помощь", "справка"};
|
||||
}
|
||||
foreach (var command in CommandHandler.Commands)
|
||||
toSend.Append(
|
||||
$"\n`{prefix}{command.Aliases[0]}`: {Utils.GetMessage($"CommandDescription{command.Aliases[0].Titleize()}")}");
|
||||
Output(ref toSend);
|
||||
toSend.Clear();
|
||||
|
||||
public override int GetArgumentsAmountRequired() {
|
||||
return 0;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override string GetSummary() {
|
||||
return "Показывает эту справку";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue