2017-05-30 04:54:59 +00:00
|
|
|
|
using Discord;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-07-17 19:42:36 +00:00
|
|
|
|
using NadekoBot.Common.Attributes;
|
2017-05-30 04:54:59 +00:00
|
|
|
|
|
|
|
|
|
namespace NadekoBot.Modules.Administration
|
|
|
|
|
{
|
|
|
|
|
public partial class Administration
|
|
|
|
|
{
|
|
|
|
|
[Group]
|
|
|
|
|
public class PrefixCommands : NadekoSubmodule
|
|
|
|
|
{
|
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
2017-07-15 03:04:16 +00:00
|
|
|
|
[Priority(1)]
|
2017-05-30 04:54:59 +00:00
|
|
|
|
public new async Task Prefix()
|
|
|
|
|
{
|
|
|
|
|
await ReplyConfirmLocalized("prefix_current", Format.Code(_cmdHandler.GetPrefix(Context.Guild))).ConfigureAwait(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
|
|
|
|
[RequireContext(ContextType.Guild)]
|
|
|
|
|
[RequireUserPermission(GuildPermission.Administrator)]
|
2017-07-15 03:04:16 +00:00
|
|
|
|
[Priority(0)]
|
2017-05-30 04:54:59 +00:00
|
|
|
|
public new async Task Prefix([Remainder]string prefix)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(prefix))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var oldPrefix = base.Prefix;
|
|
|
|
|
var newPrefix = _cmdHandler.SetPrefix(Context.Guild, prefix);
|
|
|
|
|
|
|
|
|
|
await ReplyConfirmLocalized("prefix_new", Format.Code(oldPrefix), Format.Code(newPrefix)).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
|
|
|
|
[OwnerOnly]
|
|
|
|
|
public async Task DefPrefix([Remainder]string prefix)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(prefix))
|
|
|
|
|
{
|
|
|
|
|
await ReplyConfirmLocalized("defprefix_current", _cmdHandler.DefaultPrefix).ConfigureAwait(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var oldPrefix = _cmdHandler.DefaultPrefix;
|
|
|
|
|
var newPrefix = _cmdHandler.SetDefaultPrefix(prefix);
|
|
|
|
|
|
|
|
|
|
await ReplyConfirmLocalized("defprefix_new", Format.Code(oldPrefix), Format.Code(newPrefix)).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|