mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
56 lines
1.8 KiB
C#
56 lines
1.8 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, Usage, Description, Aliases]
|
|
[RequireContext(ContextType.Guild)]
|
|
[UserPerm(GuildPerm.Administrator)]
|
|
public Task XpReset(IGuildUser user)
|
|
=> XpReset(user.Id);
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
|
[RequireContext(ContextType.Guild)]
|
|
[UserPerm(GuildPerm.Administrator)]
|
|
public async Task XpReset(ulong userId)
|
|
{
|
|
var embed = new EmbedBuilder()
|
|
.WithTitle(GetText("reset"))
|
|
.WithDescription(GetText("reset_user_confirm"));
|
|
|
|
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
|
|
return;
|
|
|
|
_service.XpReset(ctx.Guild.Id, userId);
|
|
|
|
await ReplyConfirmLocalizedAsync("reset_user", userId).ConfigureAwait(false);
|
|
}
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
|
[RequireContext(ContextType.Guild)]
|
|
[UserPerm(GuildPerm.Administrator)]
|
|
public async Task XpReset()
|
|
{
|
|
var embed = new EmbedBuilder()
|
|
.WithTitle(GetText("reset"))
|
|
.WithDescription(GetText("reset_server_confirm"));
|
|
|
|
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
|
|
return;
|
|
|
|
_service.XpReset(ctx.Guild.Id);
|
|
|
|
await ReplyConfirmLocalizedAsync("reset_server").ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|
|
}
|