.newname will show the proper error in the consoel when you're ratelimited on namechanges. close #1741

This commit is contained in:
Master Kwoth 2017-10-23 04:28:49 +02:00
parent 74f058734d
commit d596eb1895

View File

@ -16,6 +16,7 @@ using NadekoBot.Common.Attributes;
using NadekoBot.Modules.Administration.Services; using NadekoBot.Modules.Administration.Services;
using Newtonsoft.Json; using Newtonsoft.Json;
using NadekoBot.Common.ShardCom; using NadekoBot.Common.ShardCom;
using Discord.Net;
namespace NadekoBot.Modules.Administration namespace NadekoBot.Modules.Administration
{ {
@ -344,7 +345,14 @@ namespace NadekoBot.Modules.Administration
if (string.IsNullOrWhiteSpace(newName)) if (string.IsNullOrWhiteSpace(newName))
return; return;
try
{
await _client.CurrentUser.ModifyAsync(u => u.Username = newName).ConfigureAwait(false); await _client.CurrentUser.ModifyAsync(u => u.Username = newName).ConfigureAwait(false);
}
catch (RateLimitedException)
{
_log.Warn("You've been ratelimited. Wait 2 hours to change your name.");
}
await ReplyConfirmLocalized("bot_name", Format.Bold(newName)).ConfigureAwait(false); await ReplyConfirmLocalized("bot_name", Format.Bold(newName)).ConfigureAwait(false);
} }