Fixed commands in other files not loading
This commit is contained in:
parent
3aefb2d991
commit
586e21b1c1
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Attributes;
|
||||
using System.Text.RegularExpressions;
|
||||
using Discord.WebSocket;
|
||||
|
||||
//todo fix delmsgoncmd
|
||||
//todo DB
|
||||
@ -18,7 +19,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[Module(".", AppendSpace = false)]
|
||||
public partial class Administration : DiscordModule
|
||||
{
|
||||
public Administration(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Administration(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -4,16 +4,16 @@ using Discord.WebSocket;
|
||||
using NadekoBot.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Administration.Commands
|
||||
namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
//todo DB
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class AutoAssignRole
|
||||
{
|
||||
public AutoAssignRole(DiscordSocketClient _client)
|
||||
public AutoAssignRole()
|
||||
{
|
||||
var _client = NadekoBot.Client;
|
||||
_client.UserJoined += (user) =>
|
||||
{
|
||||
//var config = SpecificConfigurations.Default.Of(e.Server.Id);
|
||||
|
@ -8,7 +8,7 @@
|
||||
//using System.Linq;
|
||||
|
||||
////todo DB
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// class CrossServerTextChannel : DiscordCommand
|
||||
// {
|
||||
|
@ -6,7 +6,7 @@
|
||||
//using System.Linq;
|
||||
|
||||
////todo DB
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// internal class IncidentsCommands : DiscordCommand
|
||||
// {
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
////todo DB
|
||||
////todo Add flags for every event
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// internal class LogCommand : DiscordCommand
|
||||
// {
|
||||
|
@ -8,7 +8,7 @@
|
||||
//using System.Timers;
|
||||
////todo DB
|
||||
////todo persist restarts
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// class MessageRepeater : DiscordCommand
|
||||
// {
|
||||
|
@ -13,7 +13,7 @@
|
||||
//using Timer = System.Timers.Timer;
|
||||
|
||||
////todo DB
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// internal class PlayingRotate : DiscordCommand
|
||||
// {
|
||||
|
@ -9,7 +9,7 @@ using System.Collections.Concurrent;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//todo rewrite to accept msg/sec (for example 1/5 - 1 message every 5 seconds)
|
||||
namespace NadekoBot.Modules.Administration.Commands
|
||||
namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
public partial class Administration
|
||||
{
|
||||
@ -21,16 +21,16 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
private static readonly TimeSpan ratelimitTime = new TimeSpan(0, 0, 0, 5);
|
||||
private DiscordSocketClient _client { get; }
|
||||
|
||||
public RatelimitCommand(DiscordSocketClient client)
|
||||
public RatelimitCommand()
|
||||
{
|
||||
|
||||
this._client = client;
|
||||
this._client = NadekoBot.Client;
|
||||
|
||||
_client.MessageReceived += async (imsg) =>
|
||||
{
|
||||
var channel = imsg.Channel as ITextChannel;
|
||||
|
||||
if (channel == null || await imsg.IsAuthor(client))
|
||||
if (channel == null || await imsg.IsAuthor(_client))
|
||||
return;
|
||||
ConcurrentDictionary<ulong, DateTime> userTimePair;
|
||||
if (!RatelimitingChannels.TryGetValue(channel.Id, out userTimePair)) return;
|
||||
|
@ -8,7 +8,7 @@
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
////todo DB
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// internal class SelfAssignedRolesCommand : DiscordCommand
|
||||
// {
|
||||
|
@ -6,7 +6,7 @@
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
////todo owner only
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// public partial class Administration
|
||||
// {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
//// todo DB
|
||||
//// todo rewrite
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// internal class ServerGreetCommand : DiscordCommand
|
||||
// {
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
////todo DB
|
||||
////todo rewrite
|
||||
//namespace NadekoBot.Modules.Administration.Commands
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// internal class VoicePlusTextCommand : DiscordCommand
|
||||
// {
|
||||
|
@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Attributes;
|
||||
using Discord.WebSocket;
|
||||
|
||||
//todo DB
|
||||
namespace NadekoBot.Modules.ClashOfClans
|
||||
@ -17,7 +18,7 @@ namespace NadekoBot.Modules.ClashOfClans
|
||||
{
|
||||
public static ConcurrentDictionary<ulong, List<ClashWar>> ClashWars { get; set; } = new ConcurrentDictionary<ulong, List<ClashWar>>();
|
||||
|
||||
public ClashOfClans(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public ClashOfClans(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Services;
|
||||
using NLog;
|
||||
|
||||
@ -10,10 +11,10 @@ namespace NadekoBot.Modules
|
||||
protected ILocalization _l;
|
||||
protected CommandService _commands;
|
||||
protected IBotConfiguration _config;
|
||||
protected IDiscordClient _client;
|
||||
protected DiscordSocketClient _client;
|
||||
protected Logger _log;
|
||||
|
||||
public DiscordModule(ILocalization loc, CommandService cmds, IBotConfiguration config,IDiscordClient client)
|
||||
public DiscordModule(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client)
|
||||
{
|
||||
_l = loc;
|
||||
_commands = cmds;
|
||||
|
@ -10,7 +10,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Commands
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
public partial class Gambling
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Commands.Models
|
||||
namespace NadekoBot.Modules.Gambling.Models
|
||||
{
|
||||
public class Cards
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Services;
|
||||
using Discord.WebSocket;
|
||||
|
||||
//todo DB
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
@ -14,7 +15,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
[Module("$", AppendSpace = false)]
|
||||
public partial class Gambling : DiscordModule
|
||||
{
|
||||
public Gambling(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Gambling(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
// taken from
|
||||
// http://www.codeproject.com/Tips/207582/L-t-Tr-nsl-t-r-Leet-Translator (thanks)
|
||||
// because i don't want to waste my time on this cancerous command
|
||||
namespace NadekoBot.Modules.Games.Commands
|
||||
namespace NadekoBot.Modules.Games
|
||||
{
|
||||
public partial class GamesModule
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
////todo DI into partials
|
||||
////todo DB
|
||||
//namespace NadekoBot.Modules.Games.Commands
|
||||
//namespace NadekoBot.Modules.Games
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Flower picking/planting idea is given to me by its
|
||||
|
@ -8,7 +8,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Games.Commands
|
||||
namespace NadekoBot.Modules.Games
|
||||
{
|
||||
public partial class GamesModule
|
||||
{
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
////todo DB
|
||||
////todo Rewrite?
|
||||
//namespace NadekoBot.Modules.Games.Commands
|
||||
//namespace NadekoBot.Modules.Games
|
||||
//{
|
||||
// public static class SentencesProvider
|
||||
// {
|
||||
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
// todo rewrite?
|
||||
// todo DB
|
||||
namespace NadekoBot.Modules.Games.Commands.Trivia
|
||||
namespace NadekoBot.Modules.Games.Trivia
|
||||
{
|
||||
public class TriviaGame
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
// THANKS @ShoMinamimoto for suggestions and coding help
|
||||
namespace NadekoBot.Modules.Games.Commands.Trivia
|
||||
namespace NadekoBot.Modules.Games.Trivia
|
||||
{
|
||||
public class TriviaQuestion
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Modules.Games.Commands.Trivia
|
||||
namespace NadekoBot.Modules.Games.Trivia
|
||||
{
|
||||
public class TriviaQuestionPool
|
||||
{
|
||||
|
@ -1,14 +1,14 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Modules.Games.Commands.Trivia;
|
||||
using NadekoBot.Modules.Games.Trivia;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//todo Rewrite? Fix trivia not stopping bug
|
||||
namespace NadekoBot.Modules.Games.Commands
|
||||
namespace NadekoBot.Modules.Games
|
||||
{
|
||||
public partial class GamesModule
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NadekoBot.Extensions;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Modules.Games
|
||||
{
|
||||
@ -15,7 +16,7 @@ namespace NadekoBot.Modules.Games
|
||||
{
|
||||
//todo DB
|
||||
private IEnumerable<string> _8BallResponses;
|
||||
public Games(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Games(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ using NadekoBot.Attributes;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Modules.Help
|
||||
{
|
||||
@ -20,7 +21,7 @@ namespace NadekoBot.Modules.Help
|
||||
return str + String.Format(str, NadekoBot.Credentials.ClientId);
|
||||
}
|
||||
}
|
||||
public Help(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Help(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,14 @@ using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using System.Net;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Modules.NSFW
|
||||
{
|
||||
[Module("~", AppendSpace = false)]
|
||||
public class NSFW : DiscordModule
|
||||
{
|
||||
public NSFW(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public NSFW(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -3,13 +3,14 @@ using Discord;
|
||||
using NadekoBot.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Services;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Modules.Games.Commands
|
||||
namespace NadekoBot.Modules.Games
|
||||
{
|
||||
[Module(">", AppendSpace = false)]
|
||||
public partial class Pokemon : DiscordModule
|
||||
{
|
||||
public Pokemon(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Pokemon(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
//// todo RestSharp
|
||||
//namespace NadekoBot.Modules.Searches.Commands
|
||||
//namespace NadekoBot.Modules.Searches
|
||||
//{
|
||||
// public partial class SearchesModule
|
||||
// {
|
||||
|
@ -8,7 +8,7 @@
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
////todo Unit Conversion lib
|
||||
//namespace NadekoBot.Modules.Searches.Commands
|
||||
//namespace NadekoBot.Modules.Searches
|
||||
//{
|
||||
// class ConverterCommand : DiscordCommand
|
||||
// {
|
||||
|
@ -6,7 +6,7 @@
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
//todo mathos parser replacement
|
||||
//namespace NadekoBot.Modules.Searches.Commands
|
||||
//namespace NadekoBot.Modules.Searches
|
||||
//{
|
||||
// class CalcCommand : DiscordCommand
|
||||
// {
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NadekoBot.Modules.Searches.Commands.Models;
|
||||
using NadekoBot.Modules.Searches.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
||||
* Last Updated: Feb, 2016
|
||||
*******************************************************************************/
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
namespace NadekoBot.Modules.Searches.IMDB
|
||||
{
|
||||
public static class ImdbScraper
|
||||
{
|
||||
@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
public static async Task<string> GetIMDBId(string MovieName)
|
||||
{
|
||||
string imdbUrl = await GetIMDbUrlAsync(System.Uri.EscapeUriString(MovieName));
|
||||
return match(@"http://www.imdb.com/title/(tt\d{7})", imdbUrl);
|
||||
return Match(@"http://www.imdb.com/title/(tt\d{7})", imdbUrl);
|
||||
}
|
||||
//Get IMDb URL from search results
|
||||
private static async Task<string> GetIMDbUrlAsync(string MovieName)
|
||||
@ -65,17 +65,17 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
private static async Task ParseIMDbPage(string imdbUrl, bool GetExtraInfo, ImdbMovie mov)
|
||||
{
|
||||
string html = await GetUrlDataAsync(imdbUrl + "combined");
|
||||
mov.Id = match(@"<link rel=""canonical"" href=""http://www.imdb.com/title/(tt\d{7})/combined"" />", html);
|
||||
mov.Id = Match(@"<link rel=""canonical"" href=""http://www.imdb.com/title/(tt\d{7})/combined"" />", html);
|
||||
if (!string.IsNullOrEmpty(mov.Id))
|
||||
{
|
||||
mov.Status = true;
|
||||
mov.Title = match(@"<title>(IMDb \- )*(.*?) \(.*?</title>", html, 2);
|
||||
mov.OriginalTitle = match(@"title-extra"">(.*?)<", html);
|
||||
mov.Year = match(@"<title>.*?\(.*?(\d{4}).*?).*?</title>", match(@"(<title>.*?</title>)", html));
|
||||
mov.Rating = match(@"<b>(\d.\d)/10</b>", html);
|
||||
mov.Genres = MatchAll(@"<a.*?>(.*?)</a>", match(@"Genre.?:(.*?)(</div>|See more)", html)).Cast<string>().ToList();
|
||||
mov.Plot = match(@"Plot:</h5>.*?<div class=""info-content"">(.*?)(<a|</div)", html);
|
||||
mov.Poster = match(@"<div class=""photo"">.*?<a name=""poster"".*?><img.*?src=""(.*?)"".*?</div>", html);
|
||||
mov.Title = Match(@"<title>(IMDb \- )*(.*?) \(.*?</title>", html, 2);
|
||||
mov.OriginalTitle = Match(@"title-extra"">(.*?)<", html);
|
||||
mov.Year = Match(@"<title>.*?\(.*?(\d{4}).*?).*?</title>", Match(@"(<title>.*?</title>)", html));
|
||||
mov.Rating = Match(@"<b>(\d.\d)/10</b>", html);
|
||||
mov.Genres = MatchAll(@"<a.*?>(.*?)</a>", Match(@"Genre.?:(.*?)(</div>|See more)", html)).Cast<string>().ToList();
|
||||
mov.Plot = Match(@"Plot:</h5>.*?<div class=""info-content"">(.*?)(<a|</div)", html);
|
||||
mov.Poster = Match(@"<div class=""photo"">.*?<a name=""poster"".*?><img.*?src=""(.*?)"".*?</div>", html);
|
||||
if (!string.IsNullOrEmpty(mov.Poster) && mov.Poster.IndexOf("media-imdb.com") > 0)
|
||||
{
|
||||
mov.Poster = Regex.Replace(mov.Poster, @"_V1.*?.jpg", "_V1._SY200.jpg");
|
||||
@ -97,7 +97,7 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
{
|
||||
Dictionary<string, string> release = new Dictionary<string, string>();
|
||||
string releasehtml = await GetUrlDataAsync("http://www.imdb.com/title/" + mov.Id + "/releaseinfo");
|
||||
foreach (string r in MatchAll(@"<tr class="".*?"">(.*?)</tr>", match(@"<table id=""release_dates"" class=""subpage_data spFirst"">\n*?(.*?)</table>", releasehtml)))
|
||||
foreach (string r in MatchAll(@"<tr class="".*?"">(.*?)</tr>", Match(@"<table id=""release_dates"" class=""subpage_data spFirst"">\n*?(.*?)</table>", releasehtml)))
|
||||
{
|
||||
Match rd = new Regex(@"<td>(.*?)</td>\n*?.*?<td class=.*?>(.*?)</td>", RegexOptions.Multiline).Match(r);
|
||||
release[StripHTML(rd.Groups[1].Value.Trim())] = StripHTML(rd.Groups[2].Value.Trim());
|
||||
@ -105,7 +105,7 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
//mov.ReleaseDates = release;
|
||||
|
||||
Dictionary<string, string> aka = new Dictionary<string, string>();
|
||||
List<string> list = MatchAll(@".*?<tr class="".*?"">(.*?)</tr>", match(@"<table id=""akas"" class=.*?>\n*?(.*?)</table>", releasehtml));
|
||||
List<string> list = MatchAll(@".*?<tr class="".*?"">(.*?)</tr>", Match(@"<table id=""akas"" class=.*?>\n*?(.*?)</table>", releasehtml));
|
||||
foreach (string r in list)
|
||||
{
|
||||
Match rd = new Regex(@"\n*?.*?<td>(.*?)</td>\n*?.*?<td>(.*?)</td>", RegexOptions.Multiline).Match(r);
|
||||
@ -122,11 +122,11 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
List<string> list = new List<string>();
|
||||
string mediaurl = "http://www.imdb.com/title/" + mov.Id + "/mediaindex";
|
||||
string mediahtml = await GetUrlDataAsync(mediaurl);
|
||||
int pagecount = MatchAll(@"<a href=""\?page=(.*?)"">", match(@"<span style=""padding: 0 1em;"">(.*?)</span>", mediahtml)).Count;
|
||||
int pagecount = MatchAll(@"<a href=""\?page=(.*?)"">", Match(@"<span style=""padding: 0 1em;"">(.*?)</span>", mediahtml)).Count;
|
||||
for (int p = 1; p <= pagecount + 1; p++)
|
||||
{
|
||||
mediahtml = await GetUrlDataAsync(mediaurl + "?page=" + p);
|
||||
foreach (Match m in new Regex(@"src=""(.*?)""", RegexOptions.Multiline).Matches(match(@"<div class=""thumb_list"" style=""font-size: 0px;"">(.*?)</div>", mediahtml)))
|
||||
foreach (Match m in new Regex(@"src=""(.*?)""", RegexOptions.Multiline).Matches(Match(@"<div class=""thumb_list"" style=""font-size: 0px;"">(.*?)</div>", mediahtml)))
|
||||
{
|
||||
String image = m.Groups[1].Value;
|
||||
list.Add(Regex.Replace(image, @"_V1\..*?.jpg", "_V1._SY0.jpg"));
|
||||
@ -147,7 +147,7 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
||||
}
|
||||
/*******************************[ Helper Methods ]********************************/
|
||||
//Match single instance
|
||||
private static string match(string regex, string html, int i = 1)
|
||||
private static string Match(string regex, string html, int i = 1)
|
||||
{
|
||||
return new Regex(regex, RegexOptions.Multiline).Match(html).Groups[i].Value.Trim();
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Modules.Searches.Commands.Models;
|
||||
using NadekoBot.Modules.Searches.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -11,21 +12,34 @@ using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Commands
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
public partial class SearchesModule
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class JokeCommands
|
||||
{
|
||||
//todo DB
|
||||
private List<WoWJoke> wowJokes;
|
||||
private List<WoWJoke> wowJokes = new List<WoWJoke>();
|
||||
private List<MagicItem> magicItems;
|
||||
private Logger _log;
|
||||
|
||||
public JokeCommands()
|
||||
{
|
||||
wowJokes = JsonConvert.DeserializeObject<List<WoWJoke>>(File.ReadAllText("data/wowjokes.json"));
|
||||
magicItems = JsonConvert.DeserializeObject<List<MagicItem>>(File.ReadAllText("data/magicitems.json"));
|
||||
_log = LogManager.GetCurrentClassLogger();
|
||||
if (File.Exists("data/wowjokes.json"))
|
||||
{
|
||||
wowJokes = JsonConvert.DeserializeObject<List<WoWJoke>>(File.ReadAllText("data/wowjokes.json"));
|
||||
}
|
||||
else
|
||||
_log.Warn("data/wowjokes.json is missing. WOW Jokes are not loaded.");
|
||||
|
||||
if (File.Exists("data/magicitems.json"))
|
||||
{
|
||||
magicItems = JsonConvert.DeserializeObject<List<MagicItem>>(File.ReadAllText("data/magicitems.json"));
|
||||
}
|
||||
else
|
||||
_log.Warn("data/magicitems.json is missing. Magic items are not loaded.");
|
||||
}
|
||||
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||
|
@ -11,7 +11,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//todo drawing
|
||||
namespace NadekoBot.Modules.Searches.Commands
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
public partial class Searches
|
||||
{
|
||||
|
@ -11,14 +11,10 @@ using NadekoBot.Attributes;
|
||||
using System.Net.Http;
|
||||
using NadekoBot.Extensions;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Commands
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
public partial class SearchesModule : DiscordModule
|
||||
public partial class Searches
|
||||
{
|
||||
public SearchesModule(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Memelist(IMessage imsg)
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
||||
namespace NadekoBot.Modules.Searches.Models
|
||||
{
|
||||
public class ImdbMovie
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
||||
namespace NadekoBot.Modules.Searches.Models
|
||||
{
|
||||
class MagicItem
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
||||
namespace NadekoBot.Modules.Searches.Models
|
||||
{
|
||||
public class SearchPokemon
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
||||
namespace NadekoBot.Modules.Searches.Models
|
||||
{
|
||||
public class WikipediaApiModel
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
||||
namespace NadekoBot.Modules.Searches.Models
|
||||
{
|
||||
public class WoWJoke
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
//using System.Text.RegularExpressions;
|
||||
|
||||
//todo DI into partials
|
||||
//namespace NadekoBot.Modules.Searches.Commands
|
||||
//namespace NadekoBot.Modules.Searches
|
||||
//{
|
||||
// internal class OsuCommands : DiscordCommand
|
||||
// {
|
||||
|
@ -1,15 +1,16 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Modules.Searches.Commands.Models;
|
||||
using NadekoBot.Modules.Searches.Models;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Commands
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
public partial class SearchesModule : DiscordModule
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class PokemonSearchCommands
|
||||
@ -21,12 +22,21 @@ namespace NadekoBot.Modules.Searches.Commands
|
||||
public const string PokemonAbilitiesFile = "data/pokemon/pokemon_abilities.json";
|
||||
|
||||
public const string PokemonListFile = "data/pokemon/pokemon_list.json";
|
||||
private Logger _log;
|
||||
|
||||
public PokemonSearchCommands()
|
||||
{
|
||||
if(File.Exists(PokemonListFile))
|
||||
pokemons = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemon>>(File.ReadAllText(PokemonListFile));
|
||||
pokemonAbilities = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemonAbility>>(File.ReadAllText(PokemonAbilitiesFile));
|
||||
_log = LogManager.GetCurrentClassLogger();
|
||||
if (File.Exists(PokemonListFile))
|
||||
{
|
||||
pokemons = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemon>>(File.ReadAllText(PokemonListFile));
|
||||
}
|
||||
else
|
||||
_log.Warn(PokemonListFile + " is missing. Pokemon abilities not loaded.");
|
||||
if (File.Exists(PokemonAbilitiesFile))
|
||||
pokemonAbilities = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemonAbility>>(File.ReadAllText(PokemonAbilitiesFile));
|
||||
else
|
||||
_log.Warn(PokemonAbilitiesFile + " is missing. Pokemon abilities not loaded.");
|
||||
}
|
||||
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||
|
@ -10,9 +10,9 @@
|
||||
//using System.Threading;
|
||||
|
||||
//todo DB
|
||||
//namespace NadekoBot.Modules.Searches.Commands
|
||||
//namespace NadekoBot.Modules.Searches
|
||||
//{
|
||||
// public partial class SearchesModule : DiscordModule
|
||||
// public partial class Searches
|
||||
// {
|
||||
// [Group]
|
||||
// public class StreamNotificationCommands
|
||||
@ -72,7 +72,7 @@
|
||||
// }, null, TimeSpan.Zero, TimeSpan.FromSeconds(15));
|
||||
// }
|
||||
|
||||
// public StreamNotifications(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
// public StreamNotifications(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
// {
|
||||
// }
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules.Searches.Commands.IMDB;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
@ -12,7 +11,9 @@ using NadekoBot.Attributes;
|
||||
using NadekoBot.Extensions;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using NadekoBot.Modules.Searches.Commands.Models;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Modules.Searches.Models;
|
||||
using NadekoBot.Modules.Searches.IMDB;
|
||||
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
@ -21,7 +22,7 @@ namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
private IYoutubeService _yt { get; }
|
||||
|
||||
public Searches(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client, IYoutubeService youtube) : base(loc, cmds, config, client)
|
||||
public Searches(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client, IYoutubeService youtube) : base(loc, cmds, config, client)
|
||||
{
|
||||
_yt = youtube;
|
||||
}
|
||||
|
@ -5,13 +5,14 @@ using NadekoBot.Extensions;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Services;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Modules.Translator
|
||||
{
|
||||
[Module("~", AppendSpace = false)]
|
||||
public class Translator : DiscordModule
|
||||
{
|
||||
public Translator(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Translator(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
//using System.Text.RegularExpressions;
|
||||
//using System.Timers;
|
||||
|
||||
//namespace NadekoBot.Modules.Utility.Commands
|
||||
//namespace NadekoBot.Modules.Utility
|
||||
//{
|
||||
// class Remind : DiscordCommand
|
||||
// {
|
||||
|
@ -10,6 +10,7 @@ using NadekoBot.Extensions;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
@ -17,7 +18,7 @@ namespace NadekoBot.Modules.Utility
|
||||
[Module(".", AppendSpace = false)]
|
||||
public partial class Utility : DiscordModule
|
||||
{
|
||||
public Utility(ILocalization loc, CommandService cmds, IBotConfiguration config, IDiscordClient client) : base(loc, cmds, config, client)
|
||||
public Utility(ILocalization loc, CommandService cmds, IBotConfiguration config, DiscordSocketClient client) : base(loc, cmds, config, client)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace NadekoBot
|
||||
var depMap = new DependencyMap();
|
||||
depMap.Add<ILocalization>(Localizer);
|
||||
depMap.Add<IBotConfiguration>(Config);
|
||||
depMap.Add<IDiscordClient>(Client);
|
||||
depMap.Add<DiscordSocketClient>(Client);
|
||||
depMap.Add<CommandService>(Commands);
|
||||
depMap.Add<IYoutubeService>(Youtube);
|
||||
|
||||
|
@ -4,12 +4,15 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Discord;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
|
||||
namespace NadekoBot.Services.Impl
|
||||
{
|
||||
//todo load creds
|
||||
public class BotCredentials : IBotCredentials
|
||||
{
|
||||
private Logger _log;
|
||||
|
||||
public string ClientId { get; }
|
||||
|
||||
public string GoogleApiKey { get; }
|
||||
@ -24,10 +27,16 @@ namespace NadekoBot.Services.Impl
|
||||
|
||||
public BotCredentials()
|
||||
{
|
||||
var cm = JsonConvert.DeserializeObject<CredentialsModel>(File.ReadAllText("./credentials.json"));
|
||||
Token = cm.Token;
|
||||
OwnerIds = cm.OwnerIds;
|
||||
LoLApiKey = cm.LoLApiKey;
|
||||
_log = LogManager.GetCurrentClassLogger();
|
||||
if (File.Exists("./credentials.json"))
|
||||
{
|
||||
var cm = JsonConvert.DeserializeObject<CredentialsModel>(File.ReadAllText("./credentials.json"));
|
||||
Token = cm.Token;
|
||||
OwnerIds = cm.OwnerIds;
|
||||
LoLApiKey = cm.LoLApiKey;
|
||||
}
|
||||
else
|
||||
_log.Fatal("credentials.json is missing. Failed to start.");
|
||||
}
|
||||
|
||||
private class CredentialsModel {
|
||||
|
@ -5,7 +5,7 @@ using NadekoBot.Modules.Permissions.Classes;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Modules.Permissions.Commands
|
||||
namespace NadekoBot.Modules.Permissions
|
||||
{
|
||||
internal class FilterInvitesCommand : DiscordCommand
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using NadekoBot.Modules.Permissions.Classes;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Modules.Permissions.Commands
|
||||
namespace NadekoBot.Modules.Permissions
|
||||
{
|
||||
internal class FilterWords : DiscordCommand
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user