Improved plant/pick stuff, ~ow fixed

This commit is contained in:
Kwoth 2017-03-09 03:17:58 +01:00
parent ba19524245
commit e4a62c4d5e
3 changed files with 28 additions and 17 deletions

View File

@ -162,9 +162,9 @@ namespace NadekoBot.Modules.Games
Prefix); Prefix);
if (amount > 1) if (amount > 1)
msgToSend += GetText("pick_pl", Prefix); msgToSend += " " + GetText("pick_pl", Prefix);
else else
msgToSend += GetText("pick_sn", Prefix); msgToSend += " " + GetText("pick_sn", Prefix);
IUserMessage msg; IUserMessage msg;
using (var toSend = imgData.Value.ToStream()) using (var toSend = imgData.Value.ToStream())

View File

@ -1,4 +1,5 @@
using Discord; using System;
using Discord;
using Discord.Commands; using Discord.Commands;
using NadekoBot.Attributes; using NadekoBot.Attributes;
using NadekoBot.Extensions; using NadekoBot.Extensions;
@ -20,7 +21,7 @@ namespace NadekoBot.Modules.Searches
{ {
if (string.IsNullOrWhiteSpace(query)) if (string.IsNullOrWhiteSpace(query))
return; return;
var battletag = Regex.Replace(query, "#", "-"); var battletag = query.Replace("#", "-");
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false); await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
try try
@ -73,15 +74,22 @@ namespace NadekoBot.Modules.Searches
{ {
try try
{ {
using (var http = new HttpClient()) using (var handler = new HttpClientHandler())
{ {
var url = await http.GetStringAsync($"https://api.lootbox.eu/pc/{region.ToLower()}/{battletag}/profile"); handler.ServerCertificateCustomValidationCallback = (x, y, z, e) => true;
var model = JsonConvert.DeserializeObject<OverwatchApiModel.OverwatchPlayer>(url); using (var http = new HttpClient(handler))
return model.data; {
var url =
await http.GetStringAsync(
$"https://api.lootbox.eu/pc/{region.ToLower()}/{battletag}/profile");
var model = JsonConvert.DeserializeObject<OverwatchApiModel.OverwatchPlayer>(url);
return model.data;
}
} }
} }
catch catch (Exception ex)
{ {
_log.Warn(ex);
return null; return null;
} }
} }

View File

@ -1235,13 +1235,6 @@ Don't forget to leave your discord name or id in the message.
<data name="games_curgen_enabled" xml:space="preserve"> <data name="games_curgen_enabled" xml:space="preserve">
<value>Currency generation has been enabled on this channel.</value> <value>Currency generation has been enabled on this channel.</value>
</data> </data>
<data name="games_curgen_pl" xml:space="preserve">
<value>{0} random {1} appeared! Pick them up by typing `{2}pick`</value>
<comment>plural</comment>
</data>
<data name="games_curgen_sn" xml:space="preserve">
<value>A random {0} appeared! Pick it up by typing `{1}pick`</value>
</data>
<data name="games_failed_loading_question" xml:space="preserve"> <data name="games_failed_loading_question" xml:space="preserve">
<value>Failed loading a question.</value> <value>Failed loading a question.</value>
</data> </data>
@ -2219,6 +2212,16 @@ Owner ID: {2}</value>
<value>{0} total votes cast.</value> <value>{0} total votes cast.</value>
</data> </data>
<data name="gambling_page" xml:space="preserve"> <data name="gambling_page" xml:space="preserve">
<value>Page #{0}</value> <value>page {0}</value>
</data>
<data name="gambling_no_users_found" xml:space="preserve">
<value>No users found.</value>
</data>
<data name="games_curgen_pl" xml:space="preserve">
<value>{0} random {1} appeared!</value>
<comment>plural</comment>
</data>
<data name="games_curgen_sn" xml:space="preserve">
<value>A random {0} appeared!</value>
</data> </data>
</root> </root>