- Renamed Prefix to prefix

- Updated some command string keys which were using command name to use method names now
This commit is contained in:
Kwoth
2022-01-02 16:52:39 +01:00
parent 2edda76218
commit ca9fa1b0ac
18 changed files with 91 additions and 93 deletions

View File

@@ -50,7 +50,7 @@ public partial class Administration
await ReplyConfirmLocalizedAsync(strs.boostmsg_new);
if (!sendBoostEnabled)
await ReplyPendingLocalizedAsync(strs.boostmsg_enable($"`{Prefix}boost`"));
await ReplyPendingLocalizedAsync(strs.boostmsg_enable($"`{prefix}boost`"));
}
[Cmd]
@@ -99,7 +99,7 @@ public partial class Administration
await ReplyConfirmLocalizedAsync(strs.greetmsg_new);
if (!sendGreetEnabled)
await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{prefix}greet`"));
}
[Cmd]
@@ -131,7 +131,7 @@ public partial class Administration
await ReplyConfirmLocalizedAsync(strs.greetdmmsg_new);
if (!sendGreetEnabled)
await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`"));
await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{prefix}greetdm`"));
}
[Cmd]
@@ -163,7 +163,7 @@ public partial class Administration
await ReplyConfirmLocalizedAsync(strs.byemsg_new);
if (!sendByeEnabled)
await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{prefix}bye`"));
}
[Cmd]
@@ -190,7 +190,7 @@ public partial class Administration
await _service.ByeTest((ITextChannel)ctx.Channel, user);
var enabled = _service.GetByeEnabled(ctx.Guild.Id);
if (!enabled) await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
if (!enabled) await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{prefix}bye`"));
}
[Cmd]
@@ -203,7 +203,7 @@ public partial class Administration
await _service.GreetTest((ITextChannel)ctx.Channel, user);
var enabled = _service.GetGreetEnabled(ctx.Guild.Id);
if (!enabled) await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
if (!enabled) await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{prefix}greet`"));
}
[Cmd]
@@ -222,7 +222,7 @@ public partial class Administration
await ctx.WarningAsync();
var enabled = _service.GetGreetDmEnabled(ctx.Guild.Id);
if (!enabled)
await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`"));
await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{prefix}greetdm`"));
}
}
}

View File

@@ -13,26 +13,26 @@ public partial class Administration
[Cmd]
[Priority(1)]
public async partial Task PrefixCommand()
public async partial Task Prefix()
=> await ReplyConfirmLocalizedAsync(strs.prefix_current(Format.Code(CmdHandler.GetPrefix(ctx.Guild))));
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[Priority(0)]
public partial Task PrefixCommand(Set _, [Leftover] string prefix)
=> PrefixCommand(prefix);
public partial Task Prefix(Set _, [Leftover] string prefix)
=> Prefix(prefix);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[Priority(0)]
public async partial Task PrefixCommand([Leftover] string prefix)
public async partial Task Prefix([Leftover] string prefix)
{
if (string.IsNullOrWhiteSpace(prefix))
return;
var oldPrefix = Prefix;
var oldPrefix = base.prefix;
var newPrefix = CmdHandler.SetPrefix(ctx.Guild, prefix);
await ReplyConfirmLocalizedAsync(strs.prefix_new(Format.Code(oldPrefix), Format.Code(newPrefix)));

View File

@@ -34,7 +34,7 @@ public partial class Administration
[OwnerOnly]
public async partial Task StartupCommandAdd([Leftover] string cmdText)
{
if (cmdText.StartsWith(Prefix + "die", StringComparison.InvariantCulture))
if (cmdText.StartsWith(prefix + "die", StringComparison.InvariantCulture))
return;
var guser = (IGuildUser)ctx.User;
@@ -67,7 +67,7 @@ public partial class Administration
[OwnerOnly]
public async partial Task AutoCommandAdd(int interval, [Leftover] string cmdText)
{
if (cmdText.StartsWith(Prefix + "die", StringComparison.InvariantCulture))
if (cmdText.StartsWith(prefix + "die", StringComparison.InvariantCulture))
return;
if (interval < 5)

View File

@@ -18,9 +18,9 @@ public partial class Administration
var newVal = _service.ToggleAdSarm(ctx.Guild.Id);
if (newVal)
await ReplyConfirmLocalizedAsync(strs.adsarm_enable(Prefix));
await ReplyConfirmLocalizedAsync(strs.adsarm_enable(prefix));
else
await ReplyConfirmLocalizedAsync(strs.adsarm_disable(Prefix));
await ReplyConfirmLocalizedAsync(strs.adsarm_disable(prefix));
}
[Cmd]

View File

@@ -83,7 +83,7 @@ public partial class Gambling
return SendConfirmAsync(GetText(strs.animal_race),
GetText(strs.animal_race_starting(options.StartTime)),
footer: GetText(strs.animal_race_join_instr(Prefix)));
footer: GetText(strs.animal_race_join_instr(prefix)));
}
private Task Ar_OnStarted(AnimalRace race)

View File

@@ -10,7 +10,7 @@ public partial class Games
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Hangmanlist()
=> await SendConfirmAsync(GetText(strs.hangman_types(Prefix)), _service.GetHangmanTypes().Join('\n'));
=> await SendConfirmAsync(GetText(strs.hangman_types(prefix)), _service.GetHangmanTypes().Join('\n'));
private static string Draw(HangmanGame.State state)
=> $@". ┌─────┐

View File

@@ -27,7 +27,7 @@ public partial class Games
var channel = (ITextChannel)ctx.Channel;
var game = _service.RunningContests.GetOrAdd(ctx.Guild.Id,
_ => new(_games, _client, channel, Prefix, options, _eb));
_ => new(_games, _client, channel, prefix, options, _eb));
if (game.IsActive)
await SendErrorAsync($"Contest already running in {game.Channel.Mention} channel.");

View File

@@ -50,7 +50,7 @@ public partial class Games
channel.Guild,
channel,
opts,
Prefix + "tq",
prefix + "tq",
_eb);
if (_service.RunningTrivias.TryAdd(channel.Guild.Id, trivia))
{

View File

@@ -51,9 +51,9 @@ public partial class Help : NadekoModule<HelpService>
var clientId = await _lazyClientId.Value;
var r = new ReplacementBuilder().WithDefault(Context)
.WithOverride("{0}", () => clientId.ToString())
.WithOverride("{1}", () => Prefix)
.WithOverride("%prefix%", () => Prefix)
.WithOverride("%bot.prefix%", () => Prefix)
.WithOverride("{1}", () => prefix)
.WithOverride("%prefix%", () => prefix)
.WithOverride("%bot.prefix%", () => prefix)
.Build();
var text = SmartText.CreateFrom(botSettings.HelpText);
@@ -89,7 +89,7 @@ public partial class Help : NadekoModule<HelpService>
.ForEach(module => embed.AddField($"{GetModuleEmoji(module.Name)} {module.Name}",
GetText(GetModuleLocStr(module.Name))
+ "\n"
+ Format.Code(GetText(strs.module_footer(Prefix, module.Name.ToLowerInvariant()))),
+ Format.Code(GetText(strs.module_footer(prefix, module.Name.ToLowerInvariant()))),
true));
return embed;
@@ -233,9 +233,9 @@ public partial class Help : NadekoModule<HelpService>
//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.First(),-15} {"[" + x.Aliases.Skip(1).FirstOrDefault() + "]",-8}";
$"{(succ.Contains(x) ? "" : "")}{prefix + x.Aliases.First(),-15} {"[" + x.Aliases.Skip(1).FirstOrDefault() + "]",-8}";
return
$"{Prefix + x.Aliases.First(),-15} {"[" + x.Aliases.Skip(1).FirstOrDefault() + "]",-8}";
$"{prefix + x.Aliases.First(),-15} {"[" + x.Aliases.Skip(1).FirstOrDefault() + "]",-8}";
});
if (i == last - 1 && (i + 1) % 2 != 0)
@@ -250,7 +250,7 @@ public partial class Help : NadekoModule<HelpService>
}
}
embed.WithFooter(GetText(strs.commands_instr(Prefix)));
embed.WithFooter(GetText(strs.commands_instr(prefix)));
await ctx.Channel.EmbedAsync(embed);
}
@@ -321,9 +321,9 @@ public partial class Help : NadekoModule<HelpService>
return new CommandJsonObject
{
Aliases = com.Aliases.Select(alias => Prefix + alias).ToArray(),
Description = com.RealSummary(_strings, ctx.Guild?.Id, Prefix),
Usage = com.RealRemarksArr(_strings, ctx.Guild?.Id, Prefix),
Aliases = com.Aliases.Select(alias => prefix + alias).ToArray(),
Description = com.RealSummary(_strings, ctx.Guild?.Id, prefix),
Usage = com.RealRemarksArr(_strings, ctx.Guild?.Id, prefix),
Submodule = com.Module.Name,
Module = com.Module.GetTopLevelModule().Name,
Options = optHelpStr,

View File

@@ -122,7 +122,7 @@ public sealed partial class Music : NadekoModule<IMusicService>
queuedMessage?.DeleteAfter(10, _logService);
if (mp.IsStopped)
{
var msg = await ReplyPendingLocalizedAsync(strs.queue_stopped(Format.Code(Prefix + "play")));
var msg = await ReplyPendingLocalizedAsync(strs.queue_stopped(Format.Code(prefix + "play")));
msg.DeleteAfter(10, _logService);
}
}
@@ -281,7 +281,7 @@ public sealed partial class Music : NadekoModule<IMusicService>
var repeatType = mp.Repeat;
var add = string.Empty;
if (mp.IsStopped)
add += Format.Bold(GetText(strs.queue_stopped(Format.Code(Prefix + "play")))) + "\n";
add += Format.Bold(GetText(strs.queue_stopped(Format.Code(prefix + "play")))) + "\n";
// var mps = mp.MaxPlaytimeSeconds;
// if (mps > 0)
// add += Format.Bold(GetText(strs.song_skips_after(TimeSpan.FromSeconds(mps).ToString("HH\\:mm\\:ss")))) + "\n";

View File

@@ -108,7 +108,7 @@ public partial class Permissions : NadekoModule<PermissionService>
.Select(p =>
{
var str =
$"`{p.Index + 1}.` {Format.Bold(p.GetCommand(Prefix, (SocketGuild)ctx.Guild))}";
$"`{p.Index + 1}.` {Format.Bold(p.GetCommand(prefix, (SocketGuild)ctx.Guild))}";
if (p.Index == 0)
str += $" [{GetText(strs.uneditable)}]";
return str;
@@ -139,7 +139,7 @@ public partial class Permissions : NadekoModule<PermissionService>
}
await ReplyConfirmLocalizedAsync(strs.removed(index + 1,
Format.Code(p.GetCommand(Prefix, (SocketGuild)ctx.Guild))));
Format.Code(p.GetCommand(prefix, (SocketGuild)ctx.Guild))));
}
catch (IndexOutOfRangeException)
{
@@ -186,7 +186,7 @@ public partial class Permissions : NadekoModule<PermissionService>
}
await ReplyConfirmLocalizedAsync(strs.moved_permission(
Format.Code(fromPerm.GetCommand(Prefix, (SocketGuild)ctx.Guild)),
Format.Code(fromPerm.GetCommand(prefix, (SocketGuild)ctx.Guild)),
++from,
++to));

View File

@@ -22,7 +22,7 @@ public partial class Searches
[Cmd]
public async partial Task Placelist()
=> await SendConfirmAsync(GetText(strs.list_of_place_tags(Prefix)), _typesStr);
=> await SendConfirmAsync(GetText(strs.list_of_place_tags(prefix)), _typesStr);
[Cmd]
public async partial Task Place(PlaceType placeType, uint width = 0, uint height = 0)

View File

@@ -42,7 +42,7 @@ public partial class Utility
.DistinctBy(x => x.Name)
.Select(x => x.Name)
.Except(new[] { "ToString", "Equals", "GetHashCode", "GetType" });
await SendConfirmAsync(GetText(strs.calcops(Prefix)), string.Join(", ", selection));
await SendConfirmAsync(GetText(strs.calcops(prefix)), string.Join(", ", selection));
}
}
}