Embed field names and values will be trimmed to their acceptable length to prevent errors. closes #1355
This commit is contained in:
parent
72e7b04319
commit
aa01314b3a
@ -1,4 +1,5 @@
|
||||
using Discord;
|
||||
using NadekoBot.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System;
|
||||
@ -72,6 +73,12 @@ namespace NadekoBot.DataStructures
|
||||
{
|
||||
var crembed = JsonConvert.DeserializeObject<CREmbed>(input);
|
||||
|
||||
if(crembed.Fields != null && crembed.Fields.Length > 0)
|
||||
foreach (var f in crembed.Fields)
|
||||
{
|
||||
f.Name = f.Name.TrimTo(256);
|
||||
f.Value = f.Value.TrimTo(1024);
|
||||
}
|
||||
if (!crembed.IsValid)
|
||||
return false;
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace NadekoBot.Modules.CustomReactions
|
||||
.WithTitle(GetText("new_cust_react"))
|
||||
.WithDescription($"#{cr.Id}")
|
||||
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(key))
|
||||
.AddField(efb => efb.WithName(GetText("response")).WithValue(message))
|
||||
.AddField(efb => efb.WithName(GetText("response")).WithValue(message.Length > 1024 ? GetText("redacted_too_long") : message))
|
||||
).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Searches
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
public async Task Lolban()
|
||||
{
|
||||
const int showCount = 8;
|
||||
//const int showCount = 8;
|
||||
//http://api.champion.gg/stats/champs/mostBanned?api_key=YOUR_API_TOKEN&page=1&limit=2
|
||||
try
|
||||
{
|
||||
|
@ -35,6 +35,7 @@
|
||||
"customreactions_stats_cleared": "Stats cleared for {0} custom reaction.",
|
||||
"customreactions_stats_not_found": "No stats for that trigger found, no action taken.",
|
||||
"customreactions_trigger": "Trigger",
|
||||
"customreactions_redacted_too_long": "Redecated because it's too long.",
|
||||
"nsfw_autohentai_stopped": "Autohentai stopped.",
|
||||
"nsfw_not_found": "No results found.",
|
||||
"pokemon_already_fainted": "{0} has already fainted.",
|
||||
|
Loading…
Reference in New Issue
Block a user