added crown emoji next to commands if -v 1 or -v2 option is specified
cleanup hangman a little
This commit is contained in:
parent
b9b53ef3e8
commit
73db4e59c2
2 changed files with 167 additions and 154 deletions
src/EllieBot/Modules
|
@ -51,12 +51,9 @@ public sealed class HangmanService : IHangmanService, IExecNoCommand
|
|||
}
|
||||
|
||||
public ValueTask<bool> StopHangman(ulong channelId)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
if (_hangmanGames.TryRemove(channelId, out _))
|
||||
return new(true);
|
||||
}
|
||||
|
||||
return new(false);
|
||||
}
|
||||
|
@ -66,8 +63,11 @@ public sealed class HangmanService : IHangmanService, IExecNoCommand
|
|||
|
||||
public async Task ExecOnNoCommandAsync(IGuild guild, IUserMessage msg)
|
||||
{
|
||||
if (_hangmanGames.ContainsKey(msg.Channel.Id))
|
||||
if (!_hangmanGames.ContainsKey(msg.Channel.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(msg.Content))
|
||||
return;
|
||||
|
||||
|
@ -108,7 +108,6 @@ public sealed class HangmanService : IHangmanService, IExecNoCommand
|
|||
|
||||
await SendState((ITextChannel)msg.Channel, msg.Author, msg.Content, state);
|
||||
}
|
||||
}
|
||||
|
||||
private Task<IUserMessage> SendState(
|
||||
ITextChannel channel,
|
||||
|
|
|
@ -322,17 +322,29 @@ public sealed partial class Help : EllieModule<HelpService>
|
|||
var transformed = g
|
||||
.Select(x =>
|
||||
{
|
||||
var prepend = string.Empty;
|
||||
|
||||
var isOwnerOnly = x.Preconditions.Any(x => x is OwnerOnlyAttribute);
|
||||
if (isOwnerOnly)
|
||||
prepend = " \\👑";
|
||||
|
||||
//if cross is specified, and the command doesn't satisfy the requirements, cross it out
|
||||
if (opts.View == CommandsOptions.ViewType.Cross)
|
||||
{
|
||||
return $"{(succ.Contains(x) ? "✅" : "❌")} {prefix + x.Aliases[0]}";
|
||||
var outp = $"{(succ.Contains(x) ? "✅" : "❌")} {prefix + x.Aliases[0]}";
|
||||
|
||||
return prepend + outp;
|
||||
}
|
||||
|
||||
var output = prefix + x.Aliases[0];
|
||||
|
||||
if (x.Aliases.Count == 1)
|
||||
return prefix + x.Aliases[0];
|
||||
if (x.Aliases.Count > 1)
|
||||
output += " | " + prefix + x.Aliases[1];
|
||||
|
||||
return prefix + x.Aliases[0] + " | " + prefix + x.Aliases[1];
|
||||
if (opts.View == CommandsOptions.ViewType.All)
|
||||
return prepend + output;
|
||||
|
||||
return output;
|
||||
});
|
||||
|
||||
embed.AddField(g.Key, "" + string.Join("\n", transformed) + "", true);
|
||||
|
@ -347,7 +359,9 @@ public sealed partial class Help : EllieModule<HelpService>
|
|||
{
|
||||
var groupName = smc.Data.Values.FirstOrDefault();
|
||||
var mdl = _cmds.Modules.FirstOrDefault(x
|
||||
=> string.Equals(x.Name.Replace("Commands", ""), groupName, StringComparison.InvariantCultureIgnoreCase));
|
||||
=> string.Equals(x.Name.Replace("Commands", ""),
|
||||
groupName,
|
||||
StringComparison.InvariantCultureIgnoreCase));
|
||||
await smc.DeferAsync();
|
||||
await Group(mdl);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue