Some replacements, osu commands converted
This commit is contained in:
@@ -494,10 +494,10 @@ namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// var channel = imsg.Channel as ITextChannel;
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(e.GetArg("img")))
|
||||
// if (string.IsNullOrWhiteSpace(img))
|
||||
// return;
|
||||
// // Gather user provided URL.
|
||||
// var avatarAddress = e.GetArg("img");
|
||||
// var avatarAddress = img;
|
||||
// var imageStream = await SearchHelper.GetResponseStreamAsync(avatarAddress).ConfigureAwait(false);
|
||||
// var image = System.Drawing.Image.FromStream(imageStream);
|
||||
// await client.CurrentUser.Edit("", avatar: image.ToStream()).ConfigureAwait(false);
|
||||
@@ -515,7 +515,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
// game = game ?? "";
|
||||
|
||||
// client.SetGame(e.GetArg("set_game"));
|
||||
// client.SetGame(set_game);
|
||||
//}
|
||||
|
||||
////todo owner only
|
||||
@@ -570,8 +570,8 @@ namespace NadekoBot.Modules.Administration
|
||||
//public async Task Donadd(IMessage imsg, IUser donator, int amount)
|
||||
//{
|
||||
// var channel = imsg.Channel as ITextChannel;
|
||||
// var donator = channel.Guild.FindUsers(e.GetArg("donator")).FirstOrDefault();
|
||||
// var amount = int.Parse(e.GetArg("amount"));
|
||||
// var donator = channel.Guild.FindUsers(donator).FirstOrDefault();
|
||||
// var amount = int.Parse(amount);
|
||||
// if (donator == null) return;
|
||||
// try
|
||||
// {
|
||||
|
@@ -86,7 +86,7 @@
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// int token;
|
||||
// if (!int.TryParse(e.GetArg("token"), out token))
|
||||
// if (!int.TryParse(token, out token))
|
||||
// return;
|
||||
// HashSet<Channel> set;
|
||||
// if (!Subscribers.TryGetValue(token, out set))
|
||||
|
@@ -456,7 +456,7 @@
|
||||
// {
|
||||
|
||||
// var config = SpecificConfigurations.Default.Of(e.Server.Id);
|
||||
// if (e.GetArg("all")?.ToLower() == "all")
|
||||
// if (all?.ToLower() == "all")
|
||||
// {
|
||||
// foreach (var voiceChannel in e.Server.VoiceChannels)
|
||||
// {
|
||||
|
@@ -80,8 +80,8 @@
|
||||
// .AddCheck(SimpleCheckers.ManageMessages())
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var minutesStr = e.GetArg("minutes");
|
||||
// var msg = e.GetArg("msg");
|
||||
// var minutesStr = minutes;
|
||||
// var msg = msg;
|
||||
|
||||
// // if both null, disable
|
||||
// if (string.IsNullOrWhiteSpace(msg) && string.IsNullOrWhiteSpace(minutesStr))
|
||||
|
@@ -109,7 +109,7 @@
|
||||
// .AddCheck(SimpleCheckers.OwnerOnly())
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var arg = e.GetArg("text");
|
||||
// var arg = text;
|
||||
// if (string.IsNullOrWhiteSpace(arg))
|
||||
// return;
|
||||
// await playingPlaceholderLock.WaitAsync().ConfigureAwait(false);
|
||||
@@ -149,7 +149,7 @@
|
||||
// .AddCheck(SimpleCheckers.OwnerOnly())
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var arg = e.GetArg("number");
|
||||
// var arg = number;
|
||||
// int num;
|
||||
// string str;
|
||||
// await playingPlaceholderLock.WaitAsync().ConfigureAwait(false);
|
||||
|
@@ -49,7 +49,7 @@
|
||||
// .AddCheck(SimpleCheckers.CanManageRoles)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var roleName = e.GetArg("role")?.Trim();
|
||||
// var roleName = role?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(roleName))
|
||||
// return;
|
||||
// var role = e.Server.FindRoles(roleName).FirstOrDefault();
|
||||
@@ -116,7 +116,7 @@
|
||||
// .Parameter("role", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var roleName = e.GetArg("role")?.Trim();
|
||||
// var roleName = role?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(roleName))
|
||||
// return;
|
||||
// var role = e.Server.FindRoles(roleName).FirstOrDefault();
|
||||
@@ -172,7 +172,7 @@
|
||||
// .Parameter("role", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var roleName = e.GetArg("role")?.Trim();
|
||||
// var roleName = role?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(roleName))
|
||||
// return;
|
||||
// var role = e.Server.FindRoles(roleName).FirstOrDefault();
|
||||
|
@@ -240,14 +240,14 @@
|
||||
// {
|
||||
// if (!imsg.Author.ServerPermissions.ManageServer) return;
|
||||
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
|
||||
// if (string.IsNullOrWhiteSpace(e.GetArg("msg")))
|
||||
// if (string.IsNullOrWhiteSpace(msg))
|
||||
// {
|
||||
// await channel.SendMessageAsync("`Current greet message:` " + ann.GreetText);
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
// ann.GreetText = e.GetArg("msg");
|
||||
// ann.GreetText = msg;
|
||||
// await channel.SendMessageAsync("New greet message set.").ConfigureAwait(false);
|
||||
// if (!ann.Greet)
|
||||
// await channel.SendMessageAsync("Enable greet messsages by typing `.greet`").ConfigureAwait(false);
|
||||
@@ -273,13 +273,13 @@
|
||||
// {
|
||||
// if (!imsg.Author.ServerPermissions.ManageServer) return;
|
||||
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
|
||||
// if (string.IsNullOrWhiteSpace(e.GetArg("msg")))
|
||||
// if (string.IsNullOrWhiteSpace(msg))
|
||||
// {
|
||||
// await channel.SendMessageAsync("`Current bye message:` " + ann.ByeText);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// ann.ByeText = e.GetArg("msg");
|
||||
// ann.ByeText = msg;
|
||||
// await channel.SendMessageAsync("New bye message set.").ConfigureAwait(false);
|
||||
// if (!ann.Bye)
|
||||
// await channel.SendMessageAsync("Enable bye messsages by typing `.bye`.").ConfigureAwait(false);
|
||||
|
@@ -53,7 +53,7 @@
|
||||
// try
|
||||
// {
|
||||
// var num = 1;
|
||||
// var isParsed = int.TryParse(e.GetArg("count"), out num);
|
||||
// var isParsed = int.TryParse(count, out num);
|
||||
// if (!isParsed || num < 2)
|
||||
// {
|
||||
// var c = cards.DrawACard();
|
||||
|
@@ -34,9 +34,9 @@
|
||||
// public Func<CommandEventArgs, Task> BetFlipCoinFunc() => async e =>
|
||||
// {
|
||||
|
||||
// var amountstr = e.GetArg("amount").Trim();
|
||||
// var amountstr = amount.Trim();
|
||||
|
||||
// var guessStr = e.GetArg("guess").Trim().ToUpperInvariant();
|
||||
// var guessStr = guess.Trim().ToUpperInvariant();
|
||||
// if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
||||
// return;
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
// public Func<CommandEventArgs, Task> FlipCoinFunc() => async e =>
|
||||
// {
|
||||
|
||||
// if (e.GetArg("count") == "")
|
||||
// if (count == "")
|
||||
// {
|
||||
// if (rng.Next(0, 2) == 1)
|
||||
// await e.Channel.SendFile("heads.png", Properties.Resources.heads.ToStream(System.Drawing.Imaging.ImageFormat.Png)).ConfigureAwait(false);
|
||||
@@ -92,7 +92,7 @@
|
||||
// else
|
||||
// {
|
||||
// int result;
|
||||
// if (int.TryParse(e.GetArg("count"), out result))
|
||||
// if (int.TryParse(count, out result))
|
||||
// {
|
||||
// if (result > 10)
|
||||
// result = 10;
|
||||
|
@@ -131,7 +131,7 @@
|
||||
// .Parameter("cd", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var cdStr = e.GetArg("cd");
|
||||
// var cdStr = cd;
|
||||
// int cd = 2;
|
||||
// if (!int.TryParse(cdStr, out cd) || cd < 0)
|
||||
// {
|
||||
|
@@ -181,11 +181,11 @@
|
||||
// .Parameter("text", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// if (!NadekoBot.IsOwner(imsg.Author.Id) || string.IsNullOrWhiteSpace(e.GetArg("text"))) return;
|
||||
// if (!NadekoBot.IsOwner(imsg.Author.Id) || string.IsNullOrWhiteSpace(text)) return;
|
||||
|
||||
// DbHandler.Instance.Connection.Insert(new TypingArticle
|
||||
// {
|
||||
// Text = e.GetArg("text"),
|
||||
// Text = text,
|
||||
// DateAdded = DateTime.Now
|
||||
// });
|
||||
|
||||
|
@@ -11,6 +11,7 @@ using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using System.Net;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Extensions;
|
||||
|
||||
namespace NadekoBot.Modules.NSFW
|
||||
{
|
||||
@@ -173,9 +174,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
{
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
http.DefaultRequestHeaders.Clear();
|
||||
http.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1");
|
||||
http.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||
http.AddFakeHeaders();
|
||||
|
||||
var webpage = await http.GetStringAsync("http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&tags="+ tag.Replace(" ", "_")).ConfigureAwait(false);
|
||||
var matches = Regex.Matches(webpage, "file_url=\"(?<url>.*?)\"");
|
||||
@@ -211,9 +210,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
{
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
http.DefaultRequestHeaders.Clear();
|
||||
http.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1");
|
||||
http.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||
http.AddFakeHeaders();
|
||||
var data = await http.GetStreamAsync("http://e621.net/post/index.xml?tags=" + Uri.EscapeUriString(tags) + "%20order:random&limit=1");
|
||||
var doc = XDocument.Load(data);
|
||||
return doc.Descendants("file_url").FirstOrDefault().Value;
|
||||
|
@@ -72,11 +72,11 @@
|
||||
// {
|
||||
// await e.Channel.SendIsTyping().ConfigureAwait(false);
|
||||
|
||||
// string from = e.GetArg("from-to").ToLowerInvariant().Split('>')[0];
|
||||
// string to = e.GetArg("from-to").ToLowerInvariant().Split('>')[1];
|
||||
// string from = from-to.ToLowerInvariant().Split('>')[0];
|
||||
// string to = from-to.ToLowerInvariant().Split('>')[1];
|
||||
|
||||
// float quantity = 1.0f;
|
||||
// if (!float.TryParse(e.GetArg("quantity"), out quantity))
|
||||
// if (!float.TryParse(quantity, out quantity))
|
||||
// {
|
||||
// quantity = 1.0f;
|
||||
// }
|
||||
|
@@ -27,7 +27,7 @@
|
||||
// private CustomParser parser = new CustomParser();
|
||||
// private Func<CommandEventArgs, Task> EvalFunc() => async e =>
|
||||
// {
|
||||
// string expression = e.GetArg("expression")?.Trim();
|
||||
// string expression = expression?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(expression))
|
||||
// {
|
||||
// return;
|
||||
|
@@ -124,9 +124,9 @@ namespace NadekoBot.Modules.Searches
|
||||
// try
|
||||
// {
|
||||
// //get role
|
||||
// var role = ResolvePos(e.GetArg("position"));
|
||||
// var role = ResolvePos(position);
|
||||
// var resolvedRole = role;
|
||||
// var name = e.GetArg("champ").Replace(" ", "").ToLower();
|
||||
// var name = champ.Replace(" ", "").ToLower();
|
||||
// CachedChampion champ = null;
|
||||
|
||||
// if (CachedChampionImages.TryGetValue(name + "_" + resolvedRole, out champ))
|
||||
@@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Searches
|
||||
// await e.Channel.SendFile("champ.png", champ.ImageStream).ConfigureAwait(false);
|
||||
// return;
|
||||
// }
|
||||
// var allData = JArray.Parse(await Classes.http.GetStringAsync($"http://api.champion.gg/champion/{name}?api_key={NadekoBot.Creds.LOLAPIKey}").ConfigureAwait(false));
|
||||
// var allData = JArray.Parse(await Classes.http.GetStringAsync($"http://api.champion.gg/champion/{name}?api_key={NadekoBot.Credentials.LOLAPIKey}").ConfigureAwait(false));
|
||||
// JToken data = null;
|
||||
// if (role != null)
|
||||
// {
|
||||
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Searches
|
||||
// roles[i] = ">" + roles[i] + "<";
|
||||
// }
|
||||
// var general = JArray.Parse(await http.GetStringAsync($"http://api.champion.gg/stats/" +
|
||||
// $"champs/{name}?api_key={NadekoBot.Creds.LOLAPIKey}")
|
||||
// $"champs/{name}?api_key={NadekoBot.Credentials.LOLAPIKey}")
|
||||
// .ConfigureAwait(false))
|
||||
// .FirstOrDefault(jt => jt["role"].ToString() == role)?["general"];
|
||||
// if (general == null)
|
||||
|
@@ -1,269 +1,277 @@
|
||||
//using Discord.Commands;
|
||||
//using NadekoBot.Classes;
|
||||
//using Newtonsoft.Json.Linq;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Net;
|
||||
//using System.Text.RegularExpressions;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Extensions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//todo DI into partials
|
||||
//namespace NadekoBot.Modules.Searches
|
||||
//{
|
||||
// internal class OsuCommands : DiscordCommand
|
||||
// {
|
||||
// public OsuCommands(DiscordModule module) : base(module)
|
||||
// {
|
||||
// }
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class OsuCommands
|
||||
{
|
||||
private Logger _log;
|
||||
|
||||
// internal override void Init(CommandGroupBuilder cgb)
|
||||
// {
|
||||
// cgb.CreateCommand(Module.Prefix + "osu")
|
||||
// .Description($"Shows osu stats for a player. | `{Prefix}osu Name` or `{Prefix}osu Name taiko`")
|
||||
// .Parameter("usr", ParameterType.Required)
|
||||
// .Parameter("mode", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// if (string.IsNullOrWhiteSpace(e.GetArg("usr")))
|
||||
// return;
|
||||
public OsuCommands()
|
||||
{
|
||||
_log = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Osu(IMessage imsg, string usr, string mode)
|
||||
{
|
||||
var channel = imsg.Channel as ITextChannel;
|
||||
|
||||
// using (WebClient cl = new WebClient())
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var m = 0;
|
||||
// if (!string.IsNullOrWhiteSpace(e.GetArg("mode")))
|
||||
// {
|
||||
// m = ResolveGameMode(e.GetArg("mode"));
|
||||
// }
|
||||
if (string.IsNullOrWhiteSpace(usr))
|
||||
return;
|
||||
|
||||
// cl.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
|
||||
// cl.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 6.2; Win64; x64)");
|
||||
// cl.DownloadDataAsync(new Uri($"http://lemmmy.pw/osusig/sig.php?uname={ e.GetArg("usr") }&flagshadow&xpbar&xpbarhex&pp=2&mode={m}"));
|
||||
// cl.DownloadDataCompleted += async (s, cle) =>
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// await e.Channel.SendFile($"{e.GetArg("usr")}.png", new MemoryStream(cle.Result)).ConfigureAwait(false);
|
||||
// await channel.SendMessageAsync($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`").ConfigureAwait(false);
|
||||
// }
|
||||
// catch { }
|
||||
// };
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// await channel.SendMessageAsync("💢 Failed retrieving osu signature :\\").ConfigureAwait(false);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
using (HttpClient http = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var m = 0;
|
||||
if (!string.IsNullOrWhiteSpace(mode))
|
||||
{
|
||||
m = ResolveGameMode(mode);
|
||||
}
|
||||
http.AddFakeHeaders();
|
||||
var res = await http.GetStreamAsync(new Uri($"http://lemmmy.pw/osusig/sig.php?uname={ usr }&flagshadow&xpbar&xpbarhex&pp=2&mode={m}")).ConfigureAwait(false);
|
||||
|
||||
// cgb.CreateCommand(Module.Prefix + "osu b")
|
||||
// .Description($"Shows information about an osu beatmap. |`{Prefix}osu b` https://osu.ppy.sh/s/127712`")
|
||||
// .Parameter("map", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// if (string.IsNullOrWhiteSpace(NadekoBot.Creds.OsuAPIKey))
|
||||
// {
|
||||
// await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false);
|
||||
// return;
|
||||
// }
|
||||
res.Position = 0;
|
||||
await channel.SendFileAsync(res, $"{usr}.png").ConfigureAwait(false);
|
||||
await channel.SendMessageAsync($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(usr)}\n`Image provided by https://lemmmy.pw/osusig`").ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await channel.SendMessageAsync("💢 Failed retrieving osu signature :\\").ConfigureAwait(false);
|
||||
_log.Warn(ex, "Osu command failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(e.GetArg("map")))
|
||||
// return;
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Osub(IMessage imsg, [Remainder] string map)
|
||||
{
|
||||
var channel = imsg.Channel as ITextChannel;
|
||||
|
||||
// try
|
||||
// {
|
||||
// var mapId = ResolveMap(e.GetArg("map"));
|
||||
// var reqString = $"https://osu.ppy.sh/api/get_beatmaps?k={NadekoBot.Creds.OsuAPIKey}&{mapId}";
|
||||
// var obj = JArray.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false))[0];
|
||||
// var sb = new System.Text.StringBuilder();
|
||||
// var starRating = Math.Round(Double.Parse($"{obj["difficultyrating"]}", CultureInfo.InvariantCulture), 2);
|
||||
// var time = TimeSpan.FromSeconds(Double.Parse($"{obj["total_length"]}")).ToString(@"mm\:ss");
|
||||
// sb.AppendLine($"{obj["artist"]} - {obj["title"]}, mapped by {obj["creator"]}. https://osu.ppy.sh/s/{obj["beatmapset_id"]}");
|
||||
// sb.AppendLine($"{starRating} stars, {obj["bpm"]} BPM | AR{obj["diff_approach"]}, CS{obj["diff_size"]}, OD{obj["diff_overall"]} | Length: {time}");
|
||||
// await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// await channel.SendMessageAsync("Something went wrong.");
|
||||
// }
|
||||
// });
|
||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.OsuApiKey))
|
||||
{
|
||||
await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// cgb.CreateCommand(Module.Prefix + "osu top5")
|
||||
// .Description($"Displays a user's top 5 plays. |`{Prefix}osu top5 Name`")
|
||||
// .Parameter("usr", ParameterType.Required)
|
||||
// .Parameter("mode", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// if (string.IsNullOrWhiteSpace(NadekoBot.Creds.OsuAPIKey))
|
||||
// {
|
||||
// await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false);
|
||||
// return;
|
||||
// }
|
||||
if (string.IsNullOrWhiteSpace(map))
|
||||
return;
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(e.GetArg("usr")))
|
||||
// {
|
||||
// await channel.SendMessageAsync("💢 Please provide a username.").ConfigureAwait(false);
|
||||
// return;
|
||||
// }
|
||||
try
|
||||
{
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
var mapId = ResolveMap(map);
|
||||
var reqString = $"https://osu.ppy.sh/api/get_beatmaps?k={NadekoBot.Credentials.OsuApiKey}&{mapId}";
|
||||
var obj = JArray.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false))[0];
|
||||
var sb = new System.Text.StringBuilder();
|
||||
var starRating = Math.Round(Double.Parse($"{obj["difficultyrating"]}", CultureInfo.InvariantCulture), 2);
|
||||
var time = TimeSpan.FromSeconds(Double.Parse($"{obj["total_length"]}")).ToString(@"mm\:ss");
|
||||
sb.AppendLine($"{obj["artist"]} - {obj["title"]}, mapped by {obj["creator"]}. https://osu.ppy.sh/s/{obj["beatmapset_id"]}");
|
||||
sb.AppendLine($"{starRating} stars, {obj["bpm"]} BPM | AR{obj["diff_approach"]}, CS{obj["diff_size"]}, OD{obj["diff_overall"]} | Length: {time}");
|
||||
await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await channel.SendMessageAsync("Something went wrong.");
|
||||
_log.Warn(ex, "Osub command failed");
|
||||
}
|
||||
}
|
||||
|
||||
// try
|
||||
// {
|
||||
// var m = 0;
|
||||
// if (!string.IsNullOrWhiteSpace(e.GetArg("mode")))
|
||||
// {
|
||||
// m = ResolveGameMode(e.GetArg("mode"));
|
||||
// }
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Osu5(IMessage imsg, string user, [Remainder] string mode)
|
||||
{
|
||||
var channel = imsg.Channel as ITextChannel;
|
||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.OsuApiKey))
|
||||
{
|
||||
await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// var reqString = $"https://osu.ppy.sh/api/get_user_best?k={NadekoBot.Creds.OsuAPIKey}&u={Uri.EscapeDataString(e.GetArg("usr"))}&type=string&limit=5&m={m}";
|
||||
// var obj = JArray.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false));
|
||||
// var sb = new System.Text.StringBuilder($"`Top 5 plays for {e.GetArg("usr")}:`\n```xl" + Environment.NewLine);
|
||||
// foreach (var item in obj)
|
||||
// {
|
||||
// var mapReqString = $"https://osu.ppy.sh/api/get_beatmaps?k={NadekoBot.Creds.OsuAPIKey}&b={item["beatmap_id"]}";
|
||||
// var map = JArray.Parse(await http.GetStringAsync(mapReqString).ConfigureAwait(false))[0];
|
||||
// var pp = Math.Round(Double.Parse($"{item["pp"]}", CultureInfo.InvariantCulture), 2);
|
||||
// var acc = CalculateAcc(item, m);
|
||||
// var mods = ResolveMods(Int32.Parse($"{item["enabled_mods"]}"));
|
||||
// if (mods != "+")
|
||||
// sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | **{mods,-10}** | /b/{item["beatmap_id"]}");
|
||||
// else
|
||||
// sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | /b/{item["beatmap_id"]}");
|
||||
// }
|
||||
// sb.Append("```");
|
||||
// await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// await channel.SendMessageAsync("Something went wrong.");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
if (string.IsNullOrWhiteSpace(user))
|
||||
{
|
||||
await channel.SendMessageAsync("💢 Please provide a username.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var m = 0;
|
||||
if (!string.IsNullOrWhiteSpace(mode))
|
||||
{
|
||||
m = ResolveGameMode(mode);
|
||||
}
|
||||
|
||||
// //https://osu.ppy.sh/wiki/Accuracy
|
||||
// private static Double CalculateAcc(JToken play, int mode)
|
||||
// {
|
||||
// if (mode == 0)
|
||||
// {
|
||||
// var hitPoints = Double.Parse($"{play["count50"]}") * 50 + Double.Parse($"{play["count100"]}") * 100 + Double.Parse($"{play["count300"]}") * 300;
|
||||
// var totalHits = Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countmiss"]}");
|
||||
// totalHits *= 300;
|
||||
// return Math.Round(hitPoints / totalHits * 100, 2);
|
||||
// }
|
||||
// else if (mode == 1)
|
||||
// {
|
||||
// var hitPoints = Double.Parse($"{play["countmiss"]}") * 0 + Double.Parse($"{play["count100"]}") * 0.5 + Double.Parse($"{play["count300"]}") * 1;
|
||||
// var totalHits = Double.Parse($"{play["countmiss"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}");
|
||||
// hitPoints *= 300;
|
||||
// totalHits *= 300;
|
||||
// return Math.Round(hitPoints / totalHits * 100, 2);
|
||||
// }
|
||||
// else if (mode == 2)
|
||||
// {
|
||||
// var fruitsCaught = Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}");
|
||||
// var totalFruits = Double.Parse($"{play["countmiss"]}") + Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countkatu"]}");
|
||||
// return Math.Round(fruitsCaught / totalFruits * 100, 2);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var hitPoints = Double.Parse($"{play["count50"]}") * 50 + Double.Parse($"{play["count100"]}") * 100 + Double.Parse($"{play["countkatu"]}") * 200 + (Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countgeki"]}")) * 300;
|
||||
// var totalHits = Double.Parse($"{play["countmiss"]}") + Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["countkatu"]}") + Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countgeki"]}");
|
||||
// totalHits *= 300;
|
||||
// return Math.Round(hitPoints / totalHits * 100, 2);
|
||||
// }
|
||||
// }
|
||||
var reqString = $"https://osu.ppy.sh/api/get_user_best?k={NadekoBot.Credentials.OsuApiKey}&u={Uri.EscapeDataString(user)}&type=string&limit=5&m={m}";
|
||||
var obj = JArray.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false));
|
||||
var sb = new System.Text.StringBuilder($"`Top 5 plays for {user}:`\n```xl" + Environment.NewLine);
|
||||
foreach (var item in obj)
|
||||
{
|
||||
var mapReqString = $"https://osu.ppy.sh/api/get_beatmaps?k={NadekoBot.Credentials.OsuApiKey}&b={item["beatmap_id"]}";
|
||||
var map = JArray.Parse(await http.GetStringAsync(mapReqString).ConfigureAwait(false))[0];
|
||||
var pp = Math.Round(Double.Parse($"{item["pp"]}", CultureInfo.InvariantCulture), 2);
|
||||
var acc = CalculateAcc(item, m);
|
||||
var mods = ResolveMods(Int32.Parse($"{item["enabled_mods"]}"));
|
||||
if (mods != "+")
|
||||
sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | **{mods,-10}** | /b/{item["beatmap_id"]}");
|
||||
else
|
||||
sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | /b/{item["beatmap_id"]}");
|
||||
}
|
||||
sb.Append("```");
|
||||
await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await channel.SendMessageAsync("Something went wrong.");
|
||||
_log.Warn(ex, "Osu5 command failed");
|
||||
}
|
||||
|
||||
// private static string ResolveMap(string mapLink)
|
||||
// {
|
||||
// Match s = new Regex(@"osu.ppy.sh\/s\/", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
// Match b = new Regex(@"osu.ppy.sh\/b\/", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
// Match p = new Regex(@"osu.ppy.sh\/p\/", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
// Match m = new Regex(@"&m=", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
// if (s.Success)
|
||||
// {
|
||||
// var mapId = mapLink.Substring(mapLink.IndexOf("/s/") + 3);
|
||||
// return $"s={mapId}";
|
||||
// }
|
||||
// else if (b.Success)
|
||||
// {
|
||||
// if (m.Success)
|
||||
// return $"b={mapLink.Substring(mapLink.IndexOf("/b/") + 3, mapLink.IndexOf("&m") - (mapLink.IndexOf("/b/") + 3))}";
|
||||
// else
|
||||
// return $"b={mapLink.Substring(mapLink.IndexOf("/b/") + 3)}";
|
||||
// }
|
||||
// else if (p.Success)
|
||||
// {
|
||||
// if (m.Success)
|
||||
// return $"b={mapLink.Substring(mapLink.IndexOf("?b=") + 3, mapLink.IndexOf("&m") - (mapLink.IndexOf("?b=") + 3))}";
|
||||
// else
|
||||
// return $"b={mapLink.Substring(mapLink.IndexOf("?b=") + 3)}";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return $"s={mapLink}"; //just a default incase an ID number was provided by itself (non-url)?
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// private static int ResolveGameMode(string mode)
|
||||
// {
|
||||
// switch (mode.ToLower())
|
||||
// {
|
||||
// case "std":
|
||||
// case "standard":
|
||||
// return 0;
|
||||
// case "taiko":
|
||||
// return 1;
|
||||
// case "ctb":
|
||||
// case "catchthebeat":
|
||||
// return 2;
|
||||
// case "mania":
|
||||
// case "osu!mania":
|
||||
// return 3;
|
||||
// default:
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
//https://osu.ppy.sh/wiki/Accuracy
|
||||
private static Double CalculateAcc(JToken play, int mode)
|
||||
{
|
||||
if (mode == 0)
|
||||
{
|
||||
var hitPoints = Double.Parse($"{play["count50"]}") * 50 + Double.Parse($"{play["count100"]}") * 100 + Double.Parse($"{play["count300"]}") * 300;
|
||||
var totalHits = Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countmiss"]}");
|
||||
totalHits *= 300;
|
||||
return Math.Round(hitPoints / totalHits * 100, 2);
|
||||
}
|
||||
else if (mode == 1)
|
||||
{
|
||||
var hitPoints = Double.Parse($"{play["countmiss"]}") * 0 + Double.Parse($"{play["count100"]}") * 0.5 + Double.Parse($"{play["count300"]}") * 1;
|
||||
var totalHits = Double.Parse($"{play["countmiss"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}");
|
||||
hitPoints *= 300;
|
||||
totalHits *= 300;
|
||||
return Math.Round(hitPoints / totalHits * 100, 2);
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
var fruitsCaught = Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}");
|
||||
var totalFruits = Double.Parse($"{play["countmiss"]}") + Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countkatu"]}");
|
||||
return Math.Round(fruitsCaught / totalFruits * 100, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
var hitPoints = Double.Parse($"{play["count50"]}") * 50 + Double.Parse($"{play["count100"]}") * 100 + Double.Parse($"{play["countkatu"]}") * 200 + (Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countgeki"]}")) * 300;
|
||||
var totalHits = Double.Parse($"{play["countmiss"]}") + Double.Parse($"{play["count50"]}") + Double.Parse($"{play["count100"]}") + Double.Parse($"{play["countkatu"]}") + Double.Parse($"{play["count300"]}") + Double.Parse($"{play["countgeki"]}");
|
||||
totalHits *= 300;
|
||||
return Math.Round(hitPoints / totalHits * 100, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// //https://github.com/ppy/osu-api/wiki#mods
|
||||
// private static string ResolveMods(int mods)
|
||||
// {
|
||||
// var modString = $"+";
|
||||
private static string ResolveMap(string mapLink)
|
||||
{
|
||||
Match s = new Regex(@"osu.ppy.sh\/s\/", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
Match b = new Regex(@"osu.ppy.sh\/b\/", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
Match p = new Regex(@"osu.ppy.sh\/p\/", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
Match m = new Regex(@"&m=", RegexOptions.IgnoreCase).Match(mapLink);
|
||||
if (s.Success)
|
||||
{
|
||||
var mapId = mapLink.Substring(mapLink.IndexOf("/s/") + 3);
|
||||
return $"s={mapId}";
|
||||
}
|
||||
else if (b.Success)
|
||||
{
|
||||
if (m.Success)
|
||||
return $"b={mapLink.Substring(mapLink.IndexOf("/b/") + 3, mapLink.IndexOf("&m") - (mapLink.IndexOf("/b/") + 3))}";
|
||||
else
|
||||
return $"b={mapLink.Substring(mapLink.IndexOf("/b/") + 3)}";
|
||||
}
|
||||
else if (p.Success)
|
||||
{
|
||||
if (m.Success)
|
||||
return $"b={mapLink.Substring(mapLink.IndexOf("?b=") + 3, mapLink.IndexOf("&m") - (mapLink.IndexOf("?b=") + 3))}";
|
||||
else
|
||||
return $"b={mapLink.Substring(mapLink.IndexOf("?b=") + 3)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"s={mapLink}"; //just a default incase an ID number was provided by itself (non-url)?
|
||||
}
|
||||
}
|
||||
|
||||
// if (IsBitSet(mods, 0))
|
||||
// modString += "NF";
|
||||
// if (IsBitSet(mods, 1))
|
||||
// modString += "EZ";
|
||||
// if (IsBitSet(mods, 8))
|
||||
// modString += "HT";
|
||||
private static int ResolveGameMode(string mode)
|
||||
{
|
||||
switch (mode.ToLower())
|
||||
{
|
||||
case "std":
|
||||
case "standard":
|
||||
return 0;
|
||||
case "taiko":
|
||||
return 1;
|
||||
case "ctb":
|
||||
case "catchthebeat":
|
||||
return 2;
|
||||
case "mania":
|
||||
case "osu!mania":
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// if (IsBitSet(mods, 3))
|
||||
// modString += "HD";
|
||||
// if (IsBitSet(mods, 4))
|
||||
// modString += "HR";
|
||||
// if (IsBitSet(mods, 6) && !IsBitSet(mods, 9))
|
||||
// modString += "DT";
|
||||
// if (IsBitSet(mods, 9))
|
||||
// modString += "NC";
|
||||
// if (IsBitSet(mods, 10))
|
||||
// modString += "FL";
|
||||
//https://github.com/ppy/osu-api/wiki#mods
|
||||
private static string ResolveMods(int mods)
|
||||
{
|
||||
var modString = $"+";
|
||||
|
||||
// if (IsBitSet(mods, 5))
|
||||
// modString += "SD";
|
||||
// if (IsBitSet(mods, 14))
|
||||
// modString += "PF";
|
||||
if (IsBitSet(mods, 0))
|
||||
modString += "NF";
|
||||
if (IsBitSet(mods, 1))
|
||||
modString += "EZ";
|
||||
if (IsBitSet(mods, 8))
|
||||
modString += "HT";
|
||||
|
||||
// if (IsBitSet(mods, 7))
|
||||
// modString += "RX";
|
||||
// if (IsBitSet(mods, 11))
|
||||
// modString += "AT";
|
||||
// if (IsBitSet(mods, 12))
|
||||
// modString += "SO";
|
||||
// return modString;
|
||||
// }
|
||||
if (IsBitSet(mods, 3))
|
||||
modString += "HD";
|
||||
if (IsBitSet(mods, 4))
|
||||
modString += "HR";
|
||||
if (IsBitSet(mods, 6) && !IsBitSet(mods, 9))
|
||||
modString += "DT";
|
||||
if (IsBitSet(mods, 9))
|
||||
modString += "NC";
|
||||
if (IsBitSet(mods, 10))
|
||||
modString += "FL";
|
||||
|
||||
// private static bool IsBitSet(int mods, int pos)
|
||||
// {
|
||||
// return (mods & (1 << pos)) != 0;
|
||||
// }
|
||||
if (IsBitSet(mods, 5))
|
||||
modString += "SD";
|
||||
if (IsBitSet(mods, 14))
|
||||
modString += "PF";
|
||||
|
||||
// }
|
||||
//}
|
||||
if (IsBitSet(mods, 7))
|
||||
modString += "RX";
|
||||
if (IsBitSet(mods, 11))
|
||||
modString += "AT";
|
||||
if (IsBitSet(mods, 12))
|
||||
modString += "SO";
|
||||
return modString;
|
||||
}
|
||||
|
||||
private static bool IsBitSet(int mods, int pos) =>
|
||||
(mods & (1 << pos)) != 0;
|
||||
}
|
||||
}
|
||||
}
|
@@ -154,7 +154,7 @@
|
||||
// .AddCheck(SimpleCheckers.ManageServer())
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var stream = e.GetArg("username")?.Trim();
|
||||
// var stream = username?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(stream))
|
||||
// return;
|
||||
// try
|
||||
@@ -183,7 +183,7 @@
|
||||
// .Parameter("username", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var stream = e.GetArg("username")?.Trim();
|
||||
// var stream = username?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(stream))
|
||||
// return;
|
||||
// try
|
||||
@@ -212,7 +212,7 @@
|
||||
// .Parameter("username", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var stream = e.GetArg("username")?.Trim();
|
||||
// var stream = username?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(stream))
|
||||
// return;
|
||||
// try
|
||||
@@ -241,7 +241,7 @@
|
||||
// .Parameter("username", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var username = e.GetArg("username")?.ToLower().Trim();
|
||||
// var username = username?.ToLower().Trim();
|
||||
// if (string.IsNullOrWhiteSpace(username))
|
||||
// return;
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
// private Func<CommandEventArgs, Task> TrackStream(StreamNotificationConfig.StreamType type) =>
|
||||
// async e =>
|
||||
// {
|
||||
// var username = e.GetArg("username")?.ToLowerInvariant();
|
||||
// var username = username?.ToLowerInvariant();
|
||||
// if (string.IsNullOrWhiteSpace(username))
|
||||
// return;
|
||||
|
||||
|
@@ -8,7 +8,6 @@ using System.Net.Http;
|
||||
using NadekoBot.Services;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Extensions;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using Discord.WebSocket;
|
||||
@@ -206,7 +205,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
||||
//public async Task Hearthstone(IMessage imsg, [Remainder] string name = null)
|
||||
//{
|
||||
// var channel = imsg.Channel as ITextChannel;
|
||||
// var arg = e.GetArg("name");
|
||||
// var arg = name;
|
||||
// if (string.IsNullOrWhiteSpace(arg))
|
||||
// {
|
||||
// await channel.SendMessageAsync("💢 Please enter a card name to search for.").ConfigureAwait(false);
|
||||
|
@@ -26,7 +26,7 @@
|
||||
// TrelloConfiguration.Deserializer = serializer;
|
||||
// TrelloConfiguration.JsonFactory = new ManateeFactory();
|
||||
// TrelloConfiguration.RestClientProvider = new Manatee.Trello.WebApi.WebApiClientProvider();
|
||||
// TrelloAuthorization.Default.AppKey = NadekoBot.Creds.TrelloAppKey;
|
||||
// TrelloAuthorization.Default.AppKey = NadekoBot.Credentials.TrelloAppKey;
|
||||
// //TrelloAuthorization.Default.UserToken = "[your user token]";
|
||||
|
||||
// Discord.Channel bound = null;
|
||||
@@ -80,7 +80,7 @@
|
||||
// try
|
||||
// {
|
||||
// bound = e.Channel;
|
||||
// board = new Board(e.GetArg("board_id").Trim());
|
||||
// board = new Board(board_id.Trim());
|
||||
// board.Refresh();
|
||||
// await channel.SendMessageAsync("Successfully bound to this channel and board " + board.Name);
|
||||
// t.Start();
|
||||
@@ -121,15 +121,15 @@
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// if (!NadekoBot.IsOwner(imsg.Author.Id)) return;
|
||||
// if (bound == null || board == null || bound != e.Channel || e.GetArg("list_name") == null) return;
|
||||
// if (bound == null || board == null || bound != e.Channel || list_name == null) return;
|
||||
|
||||
// int num;
|
||||
// var success = int.TryParse(e.GetArg("list_name"), out num);
|
||||
// var success = int.TryParse(list_name, out num);
|
||||
// List list = null;
|
||||
// if (success && num <= board.Lists.Count() && num > 0)
|
||||
// list = board.Lists[num - 1];
|
||||
// else
|
||||
// list = board.Lists.FirstOrDefault(l => l.Name == e.GetArg("list_name"));
|
||||
// list = board.Lists.FirstOrDefault(l => l.Name == list_name);
|
||||
|
||||
|
||||
// if (list != null)
|
||||
|
@@ -94,7 +94,7 @@
|
||||
// .Parameter("message", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var meorchStr = e.GetArg("meorchannel").ToUpperInvariant();
|
||||
// var meorchStr = meorchannel.ToUpperInvariant();
|
||||
// Channel ch;
|
||||
// bool isPrivate = false;
|
||||
// if (meorchStr == "ME")
|
||||
@@ -117,7 +117,7 @@
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var timeStr = e.GetArg("time");
|
||||
// var timeStr = time;
|
||||
|
||||
// var m = regex.Match(timeStr);
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
// ChannelId = (long)ch.Id,
|
||||
// IsPrivate = isPrivate,
|
||||
// When = time,
|
||||
// Message = e.GetArg("message"),
|
||||
// Message = message,
|
||||
// UserId = (long)imsg.Author.Id,
|
||||
// ServerId = (long)e.Server.Id
|
||||
// };
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
// reminders.Add(StartNewReminder(rem));
|
||||
|
||||
// await channel.SendMessageAsync($"⏰ I will remind \"{ch.Name}\" to \"{e.GetArg("message").ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false);
|
||||
// await channel.SendMessageAsync($"⏰ I will remind \"{ch.Name}\" to \"{message.ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false);
|
||||
// });
|
||||
// cgb.CreateCommand(Module.Prefix + "remindmsg")
|
||||
// .Description("Sets message for when the remind is triggered. " +
|
||||
@@ -185,7 +185,7 @@
|
||||
// .AddCheck(SimpleCheckers.OwnerOnly())
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var arg = e.GetArg("msg")?.Trim();
|
||||
// var arg = msg?.Trim();
|
||||
// if (string.IsNullOrWhiteSpace(arg))
|
||||
// return;
|
||||
|
||||
|
Reference in New Issue
Block a user