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")
|
var embed = new EmbedBuilder().WithTitle("Hangman Game")
|
||||||
.WithDescription(toSend)
|
.WithDescription(toSend)
|
||||||
.AddField(efb => efb.WithName("It was").WithValue(Term.Word))
|
.AddField(efb => efb.WithName("It was").WithValue(Term.Word))
|
||||||
.WithImageUrl(Term.ImageUrl)
|
|
||||||
.WithFooter(efb => efb.WithText(string.Join(" ", Guesses)));
|
.WithFooter(efb => efb.WithText(string.Join(" ", Guesses)));
|
||||||
|
if(Uri.IsWellFormedUriString(Term.ImageUrl, UriKind.Absolute))
|
||||||
|
embed.WithImageUrl(Term.ImageUrl);
|
||||||
|
|
||||||
if (Errors >= MaxErrors)
|
if (Errors >= MaxErrors)
|
||||||
await GameChannel.EmbedAsync(embed.WithErrorColor()).ConfigureAwait(false);
|
await GameChannel.EmbedAsync(embed.WithErrorColor()).ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
|
@ -89,8 +89,9 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
questionEmbed = new EmbedBuilder().WithOkColor()
|
questionEmbed = new EmbedBuilder().WithOkColor()
|
||||||
.WithTitle(GetText("trivia_game"))
|
.WithTitle(GetText("trivia_game"))
|
||||||
.AddField(eab => eab.WithName(GetText("category")).WithValue(CurrentQuestion.Category))
|
.AddField(eab => eab.WithName(GetText("category")).WithValue(CurrentQuestion.Category))
|
||||||
.AddField(eab => eab.WithName(GetText("question")).WithValue(CurrentQuestion.Question))
|
.AddField(eab => eab.WithName(GetText("question")).WithValue(CurrentQuestion.Question));
|
||||||
.WithImageUrl(CurrentQuestion.ImageUrl);
|
if (Uri.IsWellFormedUriString(CurrentQuestion.ImageUrl, UriKind.Absolute))
|
||||||
|
questionEmbed.WithImageUrl(CurrentQuestion.ImageUrl);
|
||||||
|
|
||||||
questionMessage = await Channel.EmbedAsync(questionEmbed).ConfigureAwait(false);
|
questionMessage = await Channel.EmbedAsync(questionEmbed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@ -145,11 +146,13 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Channel.EmbedAsync(new EmbedBuilder().WithErrorColor()
|
var embed = new EmbedBuilder().WithErrorColor()
|
||||||
.WithTitle(GetText("trivia_game"))
|
.WithTitle(GetText("trivia_game"))
|
||||||
.WithDescription(GetText("trivia_times_up", Format.Bold(CurrentQuestion.Answer)))
|
.WithDescription(GetText("trivia_times_up", Format.Bold(CurrentQuestion.Answer)));
|
||||||
.WithImageUrl(CurrentQuestion.AnswerImageUrl))
|
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
|
||||||
.ConfigureAwait(false);
|
embed.WithImageUrl(CurrentQuestion.AnswerImageUrl);
|
||||||
|
|
||||||
|
await Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -215,13 +218,14 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
ShouldStopGame = true;
|
ShouldStopGame = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
var embedS = new EmbedBuilder().WithOkColor()
|
||||||
.WithTitle(GetText("trivia_game"))
|
.WithTitle(GetText("trivia_game"))
|
||||||
.WithDescription(GetText("trivia_win",
|
.WithDescription(GetText("trivia_win",
|
||||||
guildUser.Mention,
|
guildUser.Mention,
|
||||||
Format.Bold(CurrentQuestion.Answer)))
|
Format.Bold(CurrentQuestion.Answer)));
|
||||||
.WithImageUrl(CurrentQuestion.AnswerImageUrl))
|
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
|
||||||
.ConfigureAwait(false);
|
embedS.WithImageUrl(CurrentQuestion.AnswerImageUrl);
|
||||||
|
await Channel.EmbedAsync(embedS).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -232,12 +236,12 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
await _cs.AddAsync(guildUser, "Won trivia", reward, true).ConfigureAwait(false);
|
await _cs.AddAsync(guildUser, "Won trivia", reward, true).ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var embed = new EmbedBuilder().WithOkColor()
|
||||||
await Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
|
||||||
.WithTitle(GetText("trivia_game"))
|
.WithTitle(GetText("trivia_game"))
|
||||||
.WithDescription(GetText("trivia_guess", guildUser.Mention, Format.Bold(CurrentQuestion.Answer)))
|
.WithDescription(GetText("trivia_guess", guildUser.Mention, Format.Bold(CurrentQuestion.Answer)));
|
||||||
.WithImageUrl(CurrentQuestion.AnswerImageUrl))
|
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
|
||||||
.ConfigureAwait(false);
|
embed.WithImageUrl(CurrentQuestion.AnswerImageUrl);
|
||||||
|
await Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { _log.Warn(ex); }
|
catch (Exception ex) { _log.Warn(ex); }
|
||||||
});
|
});
|
||||||
|
@ -39,16 +39,14 @@ namespace NadekoBot.Modules.Searches
|
|||||||
{
|
{
|
||||||
using (var http = new HttpClient())
|
using (var http = new HttpClient())
|
||||||
{
|
{
|
||||||
var data = JObject.Parse(await http.GetStringAsync($"http://api.champion.gg/stats/champs/mostBanned?" +
|
var data = JArray.Parse(await http.GetStringAsync($"http://api.champion.gg/v2/champions?champData=normalized&limit=200&api_key={_creds.LoLApiKey}"));
|
||||||
$"api_key={_creds.LoLApiKey}&page=1&" +
|
|
||||||
$"limit={showCount}")
|
var champs = data.OrderByDescending(x => (float)x["banRate"])/*.Distinct(x => x["championId"])*/.Take(6);
|
||||||
.ConfigureAwait(false))["data"] as JArray;
|
var eb = new EmbedBuilder().WithOkColor().WithTitle(Format.Underline(GetText("x_most_banned_champs", champs.Count())));
|
||||||
var dataList = data.Distinct(new ChampionNameComparer()).Take(showCount).ToList();
|
foreach (var champ in champs)
|
||||||
var eb = new EmbedBuilder().WithOkColor().WithTitle(Format.Underline(GetText("x_most_banned_champs",dataList.Count)));
|
|
||||||
foreach (var champ in dataList)
|
|
||||||
{
|
{
|
||||||
var champ1 = champ;
|
var lChamp = champ;
|
||||||
eb.AddField(efb => efb.WithName(champ1["name"].ToString()).WithValue(champ1["general"]["banRate"] + "%").WithIsInline(true));
|
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);
|
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("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("roles")).WithValue((guild.Roles.Count - 1).ToString()).WithIsInline(true))
|
||||||
.AddField(fb => fb.WithName(GetText("features")).WithValue(features).WithIsInline(true))
|
.AddField(fb => fb.WithName(GetText("features")).WithValue(features).WithIsInline(true))
|
||||||
.WithImageUrl(guild.IconUrl)
|
|
||||||
.WithColor(NadekoBot.OkColor);
|
.WithColor(NadekoBot.OkColor);
|
||||||
|
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
|
||||||
|
embed.WithImageUrl(guild.IconUrl);
|
||||||
if (guild.Emotes.Any())
|
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}>"))));
|
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