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 Discord;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
@ -71,7 +72,13 @@ namespace NadekoBot.DataStructures
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var crembed = JsonConvert.DeserializeObject<CREmbed>(input);
|
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)
|
if (!crembed.IsValid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ namespace NadekoBot.Modules.CustomReactions
|
|||||||
.WithTitle(GetText("new_cust_react"))
|
.WithTitle(GetText("new_cust_react"))
|
||||||
.WithDescription($"#{cr.Id}")
|
.WithDescription($"#{cr.Id}")
|
||||||
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(key))
|
.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);
|
).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
public async Task Lolban()
|
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
|
//http://api.champion.gg/stats/champs/mostBanned?api_key=YOUR_API_TOKEN&page=1&limit=2
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
"customreactions_stats_cleared": "Stats cleared for {0} custom reaction.",
|
"customreactions_stats_cleared": "Stats cleared for {0} custom reaction.",
|
||||||
"customreactions_stats_not_found": "No stats for that trigger found, no action taken.",
|
"customreactions_stats_not_found": "No stats for that trigger found, no action taken.",
|
||||||
"customreactions_trigger": "Trigger",
|
"customreactions_trigger": "Trigger",
|
||||||
|
"customreactions_redacted_too_long": "Redecated because it's too long.",
|
||||||
"nsfw_autohentai_stopped": "Autohentai stopped.",
|
"nsfw_autohentai_stopped": "Autohentai stopped.",
|
||||||
"nsfw_not_found": "No results found.",
|
"nsfw_not_found": "No results found.",
|
||||||
"pokemon_already_fainted": "{0} has already fainted.",
|
"pokemon_already_fainted": "{0} has already fainted.",
|
||||||
|
Loading…
Reference in New Issue
Block a user