Files
nadekobot/src/NadekoBot/Modules/Xp/ResetCommands.cs
Kwoth 70288f7670 Second iteration of source generated localized strings
- Strs renamed to strs
- Generic params will now default to object instead of string for convenient argument passing
- Many strings changed to use generated properties
2021-09-06 21:34:52 +02:00

56 lines
1.7 KiB
C#

using Discord;
using Discord.Commands;
using NadekoBot.Common.Attributes;
using NadekoBot.Modules.Xp.Services;
using System.Threading.Tasks;
namespace NadekoBot.Modules.Xp
{
public partial class Xp
{
public class ResetCommands : NadekoSubmodule<XpService>
{
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public Task XpReset(IGuildUser user)
=> XpReset(user.Id);
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async Task XpReset(ulong userId)
{
var embed = _eb.Create()
.WithTitle(GetText(strs.reset))
.WithDescription(GetText(strs.reset_user_confirm));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
return;
_service.XpReset(ctx.Guild.Id, userId);
await ReplyConfirmLocalizedAsync("reset_user", userId).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async Task XpReset()
{
var embed = _eb.Create()
.WithTitle(GetText(strs.reset))
.WithDescription(GetText(strs.reset_server_confirm));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
return;
_service.XpReset(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("reset_server").ConfigureAwait(false);
}
}
}
}