コード例 #1
0
        public async Task RedeemAsync([Remainder] string key)
        {
            var result = await Limits.RedeemKeyAsync(Context.Guild.Id, key);

            if (result.Success)
            {
                Limits.Guilds.TryGetValue(Context.Guild.Id, out TranslateLimitsNew.Guild guild);
                string appendString = null;
                if (guild != null)
                {
                    appendString = $"Remaining Characters: {guild.RemainingCharacters()}";
                }

                await SimpleEmbedAsync($"Success you have been upgraded to unlimited, this is valid for: **{result.ValidFor} characters**\n{appendString}");

                Limits.Save();
            }
            else
            {
                await SimpleEmbedAsync("Error, you were unable to redeem the provided token");
            }
        }