fixed trivia, and some other things
This commit is contained in:
parent
ab99801a37
commit
4de7e38277
@ -109,8 +109,10 @@ namespace NadekoBot.Modules.Games.Hangman
|
||||
var embed = new EmbedBuilder().WithTitle("Hangman Game")
|
||||
.WithDescription(toSend)
|
||||
.AddField(efb => efb.WithName("It was").WithValue(Term.Word))
|
||||
.WithImageUrl(Term.ImageUrl)
|
||||
.WithFooter(efb => efb.WithText(string.Join(" ", Guesses)));
|
||||
if(Uri.IsWellFormedUriString(Term.ImageUrl, UriKind.Absolute))
|
||||
embed.WithImageUrl(Term.ImageUrl);
|
||||
|
||||
if (Errors >= MaxErrors)
|
||||
await GameChannel.EmbedAsync(embed.WithErrorColor()).ConfigureAwait(false);
|
||||
else
|
||||
|
@ -89,12 +89,13 @@ namespace NadekoBot.Modules.Games.Trivia
|
||||
questionEmbed = new EmbedBuilder().WithOkColor()
|
||||
.WithTitle(GetText("trivia_game"))
|
||||
.AddField(eab => eab.WithName(GetText("category")).WithValue(CurrentQuestion.Category))
|
||||
.AddField(eab => eab.WithName(GetText("question")).WithValue(CurrentQuestion.Question))
|
||||
.WithImageUrl(CurrentQuestion.ImageUrl);
|
||||
.AddField(eab => eab.WithName(GetText("question")).WithValue(CurrentQuestion.Question));
|
||||
if (Uri.IsWellFormedUriString(CurrentQuestion.ImageUrl, UriKind.Absolute))
|
||||
questionEmbed.WithImageUrl(CurrentQuestion.ImageUrl);
|
||||
|
||||
questionMessage = await Channel.EmbedAsync(questionEmbed).ConfigureAwait(false);
|
||||
}
|
||||
catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound ||
|
||||
catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound ||
|
||||
ex.HttpCode == System.Net.HttpStatusCode.Forbidden ||
|
||||
ex.HttpCode == System.Net.HttpStatusCode.BadRequest)
|
||||
{
|
||||
@ -145,11 +146,13 @@ namespace NadekoBot.Modules.Games.Trivia
|
||||
{
|
||||
try
|
||||
{
|
||||
await Channel.EmbedAsync(new EmbedBuilder().WithErrorColor()
|
||||
var embed = new EmbedBuilder().WithErrorColor()
|
||||
.WithTitle(GetText("trivia_game"))
|
||||
.WithDescription(GetText("trivia_times_up", Format.Bold(CurrentQuestion.Answer)))
|
||||
.WithImageUrl(CurrentQuestion.AnswerImageUrl))
|
||||
.ConfigureAwait(false);
|
||||
.WithDescription(GetText("trivia_times_up", Format.Bold(CurrentQuestion.Answer)));
|
||||
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
|
||||
embed.WithImageUrl(CurrentQuestion.AnswerImageUrl);
|
||||
|
||||
await Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -215,13 +218,14 @@ namespace NadekoBot.Modules.Games.Trivia
|
||||
ShouldStopGame = true;
|
||||
try
|
||||
{
|
||||
await Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||
var embedS = new EmbedBuilder().WithOkColor()
|
||||
.WithTitle(GetText("trivia_game"))
|
||||
.WithDescription(GetText("trivia_win",
|
||||
guildUser.Mention,
|
||||
Format.Bold(CurrentQuestion.Answer)))
|
||||
.WithImageUrl(CurrentQuestion.AnswerImageUrl))
|
||||
.ConfigureAwait(false);
|
||||
Format.Bold(CurrentQuestion.Answer)));
|
||||
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
|
||||
embedS.WithImageUrl(CurrentQuestion.AnswerImageUrl);
|
||||
await Channel.EmbedAsync(embedS).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -232,12 +236,12 @@ namespace NadekoBot.Modules.Games.Trivia
|
||||
await _cs.AddAsync(guildUser, "Won trivia", reward, true).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
await Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||
var embed = new EmbedBuilder().WithOkColor()
|
||||
.WithTitle(GetText("trivia_game"))
|
||||
.WithDescription(GetText("trivia_guess", guildUser.Mention, Format.Bold(CurrentQuestion.Answer)))
|
||||
.WithImageUrl(CurrentQuestion.AnswerImageUrl))
|
||||
.ConfigureAwait(false);
|
||||
.WithDescription(GetText("trivia_guess", guildUser.Mention, Format.Bold(CurrentQuestion.Answer)));
|
||||
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
|
||||
embed.WithImageUrl(CurrentQuestion.AnswerImageUrl);
|
||||
await Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex) { _log.Warn(ex); }
|
||||
});
|
||||
|
@ -39,16 +39,14 @@ namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
var data = JObject.Parse(await http.GetStringAsync($"http://api.champion.gg/stats/champs/mostBanned?" +
|
||||
$"api_key={_creds.LoLApiKey}&page=1&" +
|
||||
$"limit={showCount}")
|
||||
.ConfigureAwait(false))["data"] as JArray;
|
||||
var dataList = data.Distinct(new ChampionNameComparer()).Take(showCount).ToList();
|
||||
var eb = new EmbedBuilder().WithOkColor().WithTitle(Format.Underline(GetText("x_most_banned_champs",dataList.Count)));
|
||||
foreach (var champ in dataList)
|
||||
var data = JArray.Parse(await http.GetStringAsync($"http://api.champion.gg/v2/champions?champData=normalized&limit=200&api_key={_creds.LoLApiKey}"));
|
||||
|
||||
var champs = data.OrderByDescending(x => (float)x["banRate"])/*.Distinct(x => x["championId"])*/.Take(6);
|
||||
var eb = new EmbedBuilder().WithOkColor().WithTitle(Format.Underline(GetText("x_most_banned_champs", champs.Count())));
|
||||
foreach (var champ in champs)
|
||||
{
|
||||
var champ1 = champ;
|
||||
eb.AddField(efb => efb.WithName(champ1["name"].ToString()).WithValue(champ1["general"]["banRate"] + "%").WithIsInline(true));
|
||||
var lChamp = champ;
|
||||
eb.AddField(efb => efb.WithName(lChamp["championId"].ToString()).WithValue((float)lChamp["banRate"] * 100 + "%").WithIsInline(true));
|
||||
}
|
||||
|
||||
await Context.Channel.EmbedAsync(eb, Format.Italics(trashTalk[new NadekoRandom().Next(0, trashTalk.Length)])).ConfigureAwait(false);
|
||||
|
@ -59,8 +59,9 @@ namespace NadekoBot.Modules.Utility
|
||||
.AddField(fb => fb.WithName(GetText("region")).WithValue(guild.VoiceRegionId.ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("roles")).WithValue((guild.Roles.Count - 1).ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("features")).WithValue(features).WithIsInline(true))
|
||||
.WithImageUrl(guild.IconUrl)
|
||||
.WithColor(NadekoBot.OkColor);
|
||||
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
|
||||
embed.WithImageUrl(guild.IconUrl);
|
||||
if (guild.Emotes.Any())
|
||||
{
|
||||
embed.AddField(fb => fb.WithName(GetText("custom_emojis") + $"({guild.Emotes.Count})").WithValue(string.Join(" ", guild.Emotes.Shuffle().Take(20).Select(e => $"{e.Name} <:{e.Name}:{e.Id}>"))));
|
||||
|
Loading…
Reference in New Issue
Block a user