fixed mistake in merge
This commit is contained in:
parent
9687da3dd0
commit
1039983fa7
@ -496,11 +496,10 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Wikia(IUserMessage umsg, string targ, [Remainder] string query = null)
|
public async Task Wikia(IUserMessage umsg, string target, [Remainder] string query = null)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
var arg = query;
|
if (string.IsNullOrWhiteSpace(target) || string.IsNullOrWhiteSpace(query))
|
||||||
if (string.IsNullOrWhiteSpace(targ) || string.IsNullOrWhiteSpace(arg))
|
|
||||||
{
|
{
|
||||||
await channel.SendMessageAsync("💢 Please enter `target query`.").ConfigureAwait(false);
|
await channel.SendMessageAsync("💢 Please enter `target query`.").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
@ -509,22 +508,19 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
using (var http = new HttpClient())
|
using (var http = new HttpClient())
|
||||||
{
|
{
|
||||||
http.DefaultRequestHeaders.Clear();
|
http.DefaultRequestHeaders.Clear();
|
||||||
string target = targ;
|
|
||||||
string search = arg;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var res = await http.GetStringAsync($"http://www.{Uri.EscapeUriString(target)}.wikia.com/api/v1/Search/List?query={Uri.EscapeUriString(search)}&limit=25&minArticleQuality=10&batch=1&namespaces=0%2C14").ConfigureAwait(false);
|
var res = await http.GetStringAsync($"http://www.{Uri.EscapeUriString(target)}.wikia.com/api/v1/Search/List?query={Uri.EscapeUriString(query)}&limit=25&minArticleQuality=10&batch=1&namespaces=0%2C14").ConfigureAwait(false);
|
||||||
var items = JObject.Parse(res);
|
var items = JObject.Parse(res);
|
||||||
var sb = new StringBuilder();
|
var response = $@"`Found:` {items["items"][0]["title"].ToString()}
|
||||||
sb.AppendLine($"`Found:` {items["items"][0]["title"].ToString()}");
|
`Total Found:` {items["total"].ToString()}
|
||||||
sb.AppendLine($"`Total Found:` {items["total"].ToString()}");
|
`Batch:` {items["currentBatch"].ToString()}/{items["batches"].ToString()}
|
||||||
sb.AppendLine($"`Batch:` {items["currentBatch"].ToString()}/{items["batches"].ToString()}");
|
`URL:` <{await _google.ShortenUrl(items["items"][0]["url"].ToString()).ConfigureAwait(false)}> / `Quality`: {items["items"][0]["quality"].ToString()}";
|
||||||
sb.Append($"`URL:` <{await _google.ShortenUrl(items["items"][0]["url"].ToString()).ConfigureAwait(false)}> / `Quality`: {items["items"][0]["quality"].ToString()}");
|
await channel.SendMessageAsync(response);
|
||||||
await channel.SendMessageAsync(sb.ToString());
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
await channel.SendMessageAsync($"💢 Failed finding `{arg}`.").ConfigureAwait(false);
|
await channel.SendMessageAsync($"💢 Failed finding `{query}`.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,143 +602,6 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task MCPing(IUserMessage umsg, [Remainder] string query = null)
|
|
||||||
{
|
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
|
||||||
var arg = query;
|
|
||||||
if (string.IsNullOrWhiteSpace(arg))
|
|
||||||
{
|
|
||||||
await channel.SendMessageAsync("💢 Please enter a ip:port.").ConfigureAwait(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
|
||||||
using (var http = new HttpClient())
|
|
||||||
{
|
|
||||||
http.DefaultRequestHeaders.Clear();
|
|
||||||
string ip = arg.Split(':')[0];
|
|
||||||
string port = arg.Split(':')[1];
|
|
||||||
var res = await http.GetStringAsync($"https://api.minetools.eu/ping/{Uri.EscapeUriString(ip)}/{Uri.EscapeUriString(port)}").ConfigureAwait(false);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var items = JObject.Parse(res);
|
|
||||||
var sb = new System.Text.StringBuilder();
|
|
||||||
int ping = (int)Math.Ceiling(Double.Parse(items["latency"].ToString()));
|
|
||||||
sb.AppendLine($"`Server:` {arg}");
|
|
||||||
sb.AppendLine($"`Version:` {items["version"]["name"].ToString()} / Protocol {items["version"]["protocol"].ToString()}");
|
|
||||||
sb.AppendLine($"`Description:` {items["description"].ToString()}");
|
|
||||||
sb.AppendLine($"`Online Players:` {items["players"]["online"].ToString()}/{items["players"]["max"].ToString()}");
|
|
||||||
sb.Append($"`Latency:` {ping}");
|
|
||||||
await channel.SendMessageAsync(sb.ToString());
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
await channel.SendMessageAsync($"💢 [MINECRAFT] Failed finding {arg}.").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task MCQuery(IUserMessage umsg, [Remainder] string query = null)
|
|
||||||
{
|
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
|
||||||
var arg = query;
|
|
||||||
if (string.IsNullOrWhiteSpace(arg))
|
|
||||||
{
|
|
||||||
await channel.SendMessageAsync("💢 Please enter a ip:port.").ConfigureAwait(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
|
||||||
using (var http = new HttpClient())
|
|
||||||
{
|
|
||||||
http.DefaultRequestHeaders.Clear();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string ip = arg.Split(':')[0];
|
|
||||||
string port = arg.Split(':')[1];
|
|
||||||
var res = await http.GetStringAsync($"https://api.minetools.eu/query/{Uri.EscapeUriString(ip)}/{Uri.EscapeUriString(port)}").ConfigureAwait(false);
|
|
||||||
var items = JObject.Parse(res);
|
|
||||||
var sb = new System.Text.StringBuilder();
|
|
||||||
sb.AppendLine($"`Server:` {arg.ToString()} 〘Status: {items["status"]}〙");
|
|
||||||
sb.AppendLine($"`Player List:`");
|
|
||||||
for (int i=0;i < items["Playerlist"].Count();i++)
|
|
||||||
{
|
|
||||||
if (i == 5)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
sb.AppendLine($"〔{i+1}. {items["Playerlist"][i]}〕");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sb.AppendLine($"`Online Players:` {items["Players"]} / {items["MaxPlayers"]}");
|
|
||||||
sb.AppendLine($"`Plugins:` {items["Plugins"]}");
|
|
||||||
sb.Append($"`Version:` {items["Version"]}");
|
|
||||||
await channel.SendMessageAsync(sb.ToString());
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
await channel.SendMessageAsync($"💢 [MINECRAFT] Failed finding server: `{arg}`.").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task MCUser(IUserMessage umsg, [Remainder] string query = null)
|
|
||||||
{
|
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
|
||||||
var arg = query;
|
|
||||||
if (string.IsNullOrWhiteSpace(arg))
|
|
||||||
{
|
|
||||||
await channel.SendMessageAsync("💢 Please enter a name or uuid.").ConfigureAwait(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
|
||||||
using (var http = new HttpClient())
|
|
||||||
{
|
|
||||||
http.DefaultRequestHeaders.Clear();
|
|
||||||
var res = await http.GetStringAsync($"https://api.minetools.eu/uuid/{Uri.EscapeUriString(arg)}").ConfigureAwait(false);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var items = JObject.Parse(res);
|
|
||||||
var sb = new System.Text.StringBuilder();
|
|
||||||
if (items["uuid"].ToString() == "null")
|
|
||||||
{
|
|
||||||
sb.Append($"💢 [MINECRAFT] Failed finding a name/uuid going by {Uri.EscapeUriString(arg)}, bugger off!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using (var httpkek = new HttpClient())
|
|
||||||
{
|
|
||||||
httpkek.DefaultRequestHeaders.Clear();
|
|
||||||
var uuid = items["uuid"].ToString();
|
|
||||||
var reskek = await http.GetStringAsync($"https://api.minetools.eu/profile/{Uri.EscapeUriString(uuid)}").ConfigureAwait(false);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var itemskek = JObject.Parse(reskek);
|
|
||||||
sb.AppendLine($"`Profile ID:` {itemskek["decoded"]["profileId"].ToString()}");
|
|
||||||
sb.AppendLine($"`Profile Name:` {itemskek["decoded"]["profileName"].ToString()}");
|
|
||||||
sb.AppendLine($"`Textures (CAPE):` {await _google.ShortenUrl(itemskek["decoded"]["textures"]["CAPE"]["url"].ToString()).ConfigureAwait(false)}");
|
|
||||||
sb.AppendLine($"`Textures (SKIN):` {await _google.ShortenUrl(itemskek["decoded"]["textures"]["SKIN"]["url"].ToString()).ConfigureAwait(false)}");
|
|
||||||
sb.Append($"`Timestamp:` {Convert.ToDateTime(itemskek["decoded"]["timestamp"].ToString())}");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await channel.SendMessageAsync(sb.ToString());
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
await channel.SendMessageAsync("💢 [MINECRAFT] Failed finding user.").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<bool> ValidateQuery(ITextChannel ch, string query)
|
public static async Task<bool> ValidateQuery(ITextChannel ch, string query)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(query.Trim())) return true;
|
if (!string.IsNullOrEmpty(query.Trim())) return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user