每当我执行!fortnite pc Ninja时,它就可以正常工作,但如果执行!fortnite pc ni.java,它将给我该错误。我尝试了很多方法来解决此问题,但没有一个起作用。我什至尝试了其他名称,他们也成功了。我认为是“。”以名字,但是我不知道我将如何解决..任何帮助将是很好的感谢。 这是代码:
[Command("fortnite")]
public async Task fortnite(string type, [Remainder]string name)
{
using (var client = new FortniteClient("aec756fb-d0ac-4808-a1e1-9be7c421ebcc"))
{
try
{
if (type == "pc" || type == "Pc")
{
var response = await client.FindPlayerAsync(Platform.Pc, Convert.ToString(name));
//solo
var solokills = response.Stats[Playlist.Solo][Stat.Kills].ValueInt;
var soloscore = response.Stats[Playlist.Solo][Stat.Score].ValueInt;
var solospm = response.Stats[Playlist.Solo][Stat.ScorePerMatch].ValueDec;
var solokd = response.Stats[Playlist.Solo][Stat.KillDeathRatio].ValueDec;
var solomatches = response.Stats[Playlist.Solo][Stat.Matches].ValueInt;
var solowr = response.Stats[Playlist.Solo][Stat.WinRatio].ValueDec;
var solokpm = response.Stats[Playlist.Solo][Stat.KillsPerMatch].ValueDec;
var solotrnrating = response.Stats[Playlist.Solo][Stat.TrnRating].Value;
var pcsolo = Helpers.CreateEmbed(Context, "**Solo**\n\nScore: " + soloscore + "\nScore Per Match: " + solospm + "\nK/D: " + solokd + "\nW/R: " + solowr + "\nMatches: " + solomatches + "\nKills: " + solokills + "\nKills Per Match: " + solokpm + "\nTRN Rating: " + solotrnrating);
pcsolo.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, pcsolo);
//duo
// await ReplyAsync("", false, pcsolo);
var duokills = response.Stats[Playlist.Duo][Stat.Kills].ValueInt;
var duoscore = response.Stats[Playlist.Duo][Stat.Score].ValueInt;
var duospm = response.Stats[Playlist.Duo][Stat.ScorePerMatch].ValueDec;
var duokd = response.Stats[Playlist.Duo][Stat.KillDeathRatio].ValueDec;
var duomatches = response.Stats[Playlist.Duo][Stat.Matches].ValueInt;
var duowr = response.Stats[Playlist.Duo][Stat.WinRatio].ValueDec;
var duokpm = response.Stats[Playlist.Duo][Stat.KillsPerMatch].ValueDec;
var duotrnrating = response.Stats[Playlist.Duo][Stat.TrnRating].Value;
var pcduo = Helpers.CreateEmbed(Context, "**Duo**\n\nScore: " + duoscore + "\nScore Per Match: " + duospm + "\nK/D: " + duokd + "\nW/R: " + duowr + "\nMatches: " + duomatches + "\nKills: " + duokills + "\nKills Per Match: " + duokpm + "\nTRN Rating: " + duotrnrating);
pcduo.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, pcduo);
//squad
var Squadkills = response.Stats[Playlist.Squad][Stat.Kills].ValueInt;
var Squadscore = response.Stats[Playlist.Squad][Stat.Score].ValueInt;
var Squadspm = response.Stats[Playlist.Squad][Stat.ScorePerMatch].ValueDec;
var Squadkd = response.Stats[Playlist.Squad][Stat.KillDeathRatio].ValueDec;
var Squadmatches = response.Stats[Playlist.Squad][Stat.Matches].ValueInt;
var Squadwr = response.Stats[Playlist.Squad][Stat.WinRatio].ValueDec;
var Squadkpm = response.Stats[Playlist.Squad][Stat.KillsPerMatch].ValueDec;
var Squadtrnrating = response.Stats[Playlist.Squad][Stat.TrnRating].Value;
var pcSquad = Helpers.CreateEmbed(Context, "**Squad**\n\nScore: " + Squadscore + "\nScore Per Match: " + Squadspm + "\nK/D: " + Squadkd + "\nW/R: " + Squadwr + "\nMatches: " + Squadmatches + "\nKills: " + Squadkills + "\nKills Per Match: " + Squadkpm + "\nTRN Rating: " + Squadtrnrating);
pcSquad.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, pcSquad);
// await ReplyAsync("", false, pcSquad);
}
else if (type == "psn" || type == "Psn")
{
var response = await client.FindPlayerAsync(Platform.Psn, name);
//solo
var solokills = response.Stats[Playlist.Solo][Stat.Kills].ValueInt;
var soloscore = response.Stats[Playlist.Solo][Stat.Score].ValueInt;
var solospm = response.Stats[Playlist.Solo][Stat.ScorePerMatch].ValueDec;
var solokd = response.Stats[Playlist.Solo][Stat.KillDeathRatio].ValueDec;
var solomatches = response.Stats[Playlist.Solo][Stat.Matches].ValueInt;
var solowr = response.Stats[Playlist.Solo][Stat.WinRatio].ValueDec;
var solokpm = response.Stats[Playlist.Solo][Stat.KillsPerMatch].ValueDec;
var solotrnrating = response.Stats[Playlist.Solo][Stat.TrnRating].Value;
var psnsolo = Helpers.CreateEmbed(Context, "**Solo**\n\nScore: " + soloscore + "\nScore Per Match: " + solospm + "\nK/D: " + solokd + "\nW/R: " + solowr + "\nMatches: " + solomatches + "\nKills: " + solokills + "\nKills Per Match: " + solokpm + "\nTRN Rating: " + solotrnrating);
psnsolo.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, psnsolo);
//duo
var duokills = response.Stats[Playlist.Duo][Stat.Kills].ValueInt;
var duoscore = response.Stats[Playlist.Duo][Stat.Score].ValueInt;
var duospm = response.Stats[Playlist.Duo][Stat.ScorePerMatch].ValueDec;
var duokd = response.Stats[Playlist.Duo][Stat.KillDeathRatio].ValueDec;
var duomatches = response.Stats[Playlist.Duo][Stat.Matches].ValueInt;
var duowr = response.Stats[Playlist.Duo][Stat.WinRatio].ValueDec;
var duokpm = response.Stats[Playlist.Duo][Stat.KillsPerMatch].ValueDec;
var duotrnrating = response.Stats[Playlist.Duo][Stat.TrnRating].Value;
var psnduo = Helpers.CreateEmbed(Context, "**Duo**\n\nScore: " + duoscore + "\nScore Per Match: " + duospm + "\nK/D: " + duokd + "\nW/R: " + duowr + "\nMatches: " + duomatches + "\nKills: " + duokills + "\nKills Per Match: " + duokpm + "\nTRN Rating: " + duotrnrating);
psnduo.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, psnduo);
//squad
var Squadkills = response.Stats[Playlist.Squad][Stat.Kills].ValueInt;
var Squadscore = response.Stats[Playlist.Squad][Stat.Score].ValueInt;
var Squadspm = response.Stats[Playlist.Squad][Stat.ScorePerMatch].ValueDec;
var Squadkd = response.Stats[Playlist.Squad][Stat.KillDeathRatio].ValueDec;
var Squadmatches = response.Stats[Playlist.Squad][Stat.Matches].ValueInt;
var Squadwr = response.Stats[Playlist.Squad][Stat.WinRatio].ValueDec;
var Squadkpm = response.Stats[Playlist.Squad][Stat.KillsPerMatch].ValueDec;
var Squadtrnrating = response.Stats[Playlist.Squad][Stat.TrnRating].Value;
var psnSquad = Helpers.CreateEmbed(Context, "**Squad**\n\nScore: " + Squadscore + "\nScore Per Match: " + Squadspm + "\nK/D: " + Squadkd + "\nW/R: " + Squadwr + "\nMatches: " + Squadmatches + "\nKills: " + Squadkills + "\nKills Per Match: " + Squadkpm + "\nTRN Rating: " + Squadtrnrating);
psnSquad.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, psnSquad);
}
else if (type == "xbl" || type == "Xbl")
{
var response = await client.FindPlayerAsync(Platform.Xbl, name);
//solo
var solokills = response.Stats[Playlist.Solo][Stat.Kills].ValueInt;
var soloscore = response.Stats[Playlist.Solo][Stat.Score].ValueInt;
var solospm = response.Stats[Playlist.Solo][Stat.ScorePerMatch].ValueDec;
var solokd = response.Stats[Playlist.Solo][Stat.KillDeathRatio].ValueDec;
var solomatches = response.Stats[Playlist.Solo][Stat.Matches].ValueInt;
var solowr = response.Stats[Playlist.Solo][Stat.WinRatio].ValueDec;
var solokpm = response.Stats[Playlist.Solo][Stat.KillsPerMatch].ValueDec;
var solotrnrating = response.Stats[Playlist.Solo][Stat.TrnRating].Value;
var xblsolo = Helpers.CreateEmbed(Context, "**Solo**\n\nScore: " + soloscore + "\nScore Per Match: " + solospm + "\nK/D: " + solokd + "\nW/R: " + solowr + "\nMatches: " + solomatches + "\nKills: " + solokills + "\nKills Per Match: " + solokpm + "\nTRN Rating: " + solotrnrating);
xblsolo.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, xblsolo);
//duo
var duokills = response.Stats[Playlist.Duo][Stat.Kills].ValueInt;
var duoscore = response.Stats[Playlist.Duo][Stat.Score].ValueInt;
var duospm = response.Stats[Playlist.Duo][Stat.ScorePerMatch].ValueDec;
var duokd = response.Stats[Playlist.Duo][Stat.KillDeathRatio].ValueDec;
var duomatches = response.Stats[Playlist.Duo][Stat.Matches].ValueInt;
var duowr = response.Stats[Playlist.Duo][Stat.WinRatio].ValueDec;
var duokpm = response.Stats[Playlist.Duo][Stat.KillsPerMatch].ValueDec;
var duotrnrating = response.Stats[Playlist.Duo][Stat.TrnRating].Value;
var xblduo = Helpers.CreateEmbed(Context, "**Duo**\n\nScore: " + duoscore + "\nScore Per Match: " + duospm + "\nK/D: " + duokd + "\nW/R: " + duowr + "\nMatches: " + duomatches + "\nKills: " + duokills + "\nKills Per Match: " + duokpm + "\nTRN Rating: " + duotrnrating);
xblduo.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, xblduo);
//squad
var Squadkills = response.Stats[Playlist.Squad][Stat.Kills].ValueInt;
var Squadscore = response.Stats[Playlist.Squad][Stat.Score].ValueInt;
var Squadspm = response.Stats[Playlist.Squad][Stat.ScorePerMatch].ValueDec;
var Squadkd = response.Stats[Playlist.Squad][Stat.KillDeathRatio].ValueDec;
var Squadmatches = response.Stats[Playlist.Squad][Stat.Matches].ValueInt;
var Squadwr = response.Stats[Playlist.Squad][Stat.WinRatio].ValueDec;
var Squadkpm = response.Stats[Playlist.Squad][Stat.KillsPerMatch].ValueDec;
var Squadtrnrating = response.Stats[Playlist.Squad][Stat.TrnRating].Value;
var xblSquad = Helpers.CreateEmbed(Context, "**Squad**\n\nScore: " + Squadscore + "\nScore Per Match: " + Squadspm + "\nK/D: " + Squadkd + "\nW/R: " + Squadwr + "\nMatches: " + Squadmatches + "\nKills: " + Squadkills + "\nKills Per Match: " + Squadkpm + "\nTRN Rating: " + Squadtrnrating);
xblSquad.WithThumbnailUrl("https://png.icons8.com/color/1600/fortnite.png");
await Helpers.SendMessage(Context, xblSquad);
}
else
{
//error message
}
}catch(Exception ex)
{
await ReplyAsync(ex.ToString());
}
}
}
答案 0 :(得分:0)
不深入探讨API特定的问题,但是,如果您的消息太长,则将其拆分并发送多条消息。
您的消息中似乎包含三个部分:solo
,duo
和squad
,每个部分发送一条消息。
如果这还不够,请抓取您的最终消息string
的一部分,最好在标点/空格处分割和/或添加省略号,以使您的消息对阅读它们的用户来说看起来不错。
答案 1 :(得分:0)
除了凌乱的代码,您正在尝试在一个嵌入中的一个字段中发送包含太多字符的消息。 根据您提供的代码,我们看不到哪个字段太长。
在您的情况下,如果邮件超过2000个字符,我将编辑您的Helpers
类以将邮件自动拆分为多个字段。希望这对您有帮助。