Merge remote-tracking branch 'refs/remotes/Kwoth/1.0' into math
# Conflicts: # src/NadekoBot/Modules/Searches/Searches.cs
This commit is contained in:
commit
89a0eb93e6
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
//todo fix delmsgoncmd
|
//todo fix delmsgoncmd
|
||||||
//todo DB
|
//todo DB
|
||||||
@ -18,7 +19,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
[Module(".", AppendSpace = false)]
|
[Module(".", AppendSpace = false)]
|
||||||
public partial class Administration : DiscordModule
|
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)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -462,7 +463,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
{
|
{
|
||||||
var channel = msg.Channel as ITextChannel;
|
var channel = msg.Channel as ITextChannel;
|
||||||
int limit = (count < 100) ? count : 100;
|
int limit = (count < 100) ? count : 100;
|
||||||
var enumerable = (await msg.Channel.GetMessagesAsync(limit: limit));
|
var enumerable = (await msg.Channel.GetMessagesAsync(limit: limit)).Where(m => m.Author == user);
|
||||||
await msg.Channel.DeleteMessagesAsync(enumerable);
|
await msg.Channel.DeleteMessagesAsync(enumerable);
|
||||||
}
|
}
|
||||||
////todo owner only
|
////todo owner only
|
||||||
|
@ -4,7 +4,7 @@ using Discord.WebSocket;
|
|||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Administration.Commands
|
namespace NadekoBot.Modules.Administration
|
||||||
{
|
{
|
||||||
//todo DB
|
//todo DB
|
||||||
public partial class Administration
|
public partial class Administration
|
||||||
@ -12,8 +12,9 @@ namespace NadekoBot.Modules.Administration.Commands
|
|||||||
[Group]
|
[Group]
|
||||||
public class AutoAssignRole
|
public class AutoAssignRole
|
||||||
{
|
{
|
||||||
public AutoAssignRole(DiscordSocketClient _client)
|
public AutoAssignRole()
|
||||||
{
|
{
|
||||||
|
var _client = NadekoBot.Client;
|
||||||
_client.UserJoined += (user) =>
|
_client.UserJoined += (user) =>
|
||||||
{
|
{
|
||||||
//var config = SpecificConfigurations.Default.Of(e.Server.Id);
|
//var config = SpecificConfigurations.Default.Of(e.Server.Id);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//using System.Linq;
|
//using System.Linq;
|
||||||
|
|
||||||
////todo DB
|
////todo DB
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// class CrossServerTextChannel : DiscordCommand
|
// class CrossServerTextChannel : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//using System.Linq;
|
//using System.Linq;
|
||||||
|
|
||||||
////todo DB
|
////todo DB
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// internal class IncidentsCommands : DiscordCommand
|
// internal class IncidentsCommands : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
////todo DB
|
////todo DB
|
||||||
////todo Add flags for every event
|
////todo Add flags for every event
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// internal class LogCommand : DiscordCommand
|
// internal class LogCommand : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//using System.Timers;
|
//using System.Timers;
|
||||||
////todo DB
|
////todo DB
|
||||||
////todo persist restarts
|
////todo persist restarts
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// class MessageRepeater : DiscordCommand
|
// class MessageRepeater : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
//using Timer = System.Timers.Timer;
|
//using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
////todo DB
|
////todo DB
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// internal class PlayingRotate : DiscordCommand
|
// internal class PlayingRotate : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -9,7 +9,7 @@ using System.Collections.Concurrent;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
//todo rewrite to accept msg/sec (for example 1/5 - 1 message every 5 seconds)
|
//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
|
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 static readonly TimeSpan ratelimitTime = new TimeSpan(0, 0, 0, 5);
|
||||||
private DiscordSocketClient _client { get; }
|
private DiscordSocketClient _client { get; }
|
||||||
|
|
||||||
public RatelimitCommand(DiscordSocketClient client)
|
public RatelimitCommand()
|
||||||
{
|
{
|
||||||
|
|
||||||
this._client = client;
|
this._client = NadekoBot.Client;
|
||||||
|
|
||||||
_client.MessageReceived += async (imsg) =>
|
_client.MessageReceived += async (imsg) =>
|
||||||
{
|
{
|
||||||
var channel = imsg.Channel as ITextChannel;
|
var channel = imsg.Channel as ITextChannel;
|
||||||
|
|
||||||
if (channel == null || await imsg.IsAuthor(client))
|
if (channel == null || await imsg.IsAuthor(_client))
|
||||||
return;
|
return;
|
||||||
ConcurrentDictionary<ulong, DateTime> userTimePair;
|
ConcurrentDictionary<ulong, DateTime> userTimePair;
|
||||||
if (!RatelimitingChannels.TryGetValue(channel.Id, out userTimePair)) return;
|
if (!RatelimitingChannels.TryGetValue(channel.Id, out userTimePair)) return;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//using System.Text;
|
//using System.Text;
|
||||||
//using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
////todo DB
|
////todo DB
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// internal class SelfAssignedRolesCommand : DiscordCommand
|
// internal class SelfAssignedRolesCommand : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
|
|
||||||
////todo owner only
|
////todo owner only
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// public partial class Administration
|
// public partial class Administration
|
||||||
// {
|
// {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
//// todo DB
|
//// todo DB
|
||||||
//// todo rewrite
|
//// todo rewrite
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// internal class ServerGreetCommand : DiscordCommand
|
// internal class ServerGreetCommand : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
////todo DB
|
////todo DB
|
||||||
////todo rewrite
|
////todo rewrite
|
||||||
//namespace NadekoBot.Modules.Administration.Commands
|
//namespace NadekoBot.Modules.Administration
|
||||||
//{
|
//{
|
||||||
// internal class VoicePlusTextCommand : DiscordCommand
|
// internal class VoicePlusTextCommand : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
|||||||
using Discord;
|
using Discord;
|
||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
//todo DB
|
//todo DB
|
||||||
namespace NadekoBot.Modules.ClashOfClans
|
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 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;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
|
using Discord.WebSocket;
|
||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
@ -10,10 +11,10 @@ namespace NadekoBot.Modules
|
|||||||
protected ILocalization _l;
|
protected ILocalization _l;
|
||||||
protected CommandService _commands;
|
protected CommandService _commands;
|
||||||
protected IBotConfiguration _config;
|
protected IBotConfiguration _config;
|
||||||
protected IDiscordClient _client;
|
protected DiscordSocketClient _client;
|
||||||
protected Logger _log;
|
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;
|
_l = loc;
|
||||||
_commands = cmds;
|
_commands = cmds;
|
||||||
|
@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Gambling.Commands
|
namespace NadekoBot.Modules.Gambling
|
||||||
{
|
{
|
||||||
public partial class Gambling
|
public partial class Gambling
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Gambling.Commands.Models
|
namespace NadekoBot.Modules.Gambling.Models
|
||||||
{
|
{
|
||||||
public class Cards
|
public class Cards
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
//todo DB
|
//todo DB
|
||||||
namespace NadekoBot.Modules.Gambling
|
namespace NadekoBot.Modules.Gambling
|
||||||
@ -14,7 +15,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[Module("$", AppendSpace = false)]
|
[Module("$", AppendSpace = false)]
|
||||||
public partial class Gambling : DiscordModule
|
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
|
// taken from
|
||||||
// http://www.codeproject.com/Tips/207582/L-t-Tr-nsl-t-r-Leet-Translator (thanks)
|
// 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
|
// 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
|
public partial class GamesModule
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
////todo DI into partials
|
////todo DI into partials
|
||||||
////todo DB
|
////todo DB
|
||||||
//namespace NadekoBot.Modules.Games.Commands
|
//namespace NadekoBot.Modules.Games
|
||||||
//{
|
//{
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// Flower picking/planting idea is given to me by its
|
// /// Flower picking/planting idea is given to me by its
|
||||||
|
@ -8,7 +8,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Games.Commands
|
namespace NadekoBot.Modules.Games
|
||||||
{
|
{
|
||||||
public partial class GamesModule
|
public partial class GamesModule
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
////todo DB
|
////todo DB
|
||||||
////todo Rewrite?
|
////todo Rewrite?
|
||||||
//namespace NadekoBot.Modules.Games.Commands
|
//namespace NadekoBot.Modules.Games
|
||||||
//{
|
//{
|
||||||
// public static class SentencesProvider
|
// public static class SentencesProvider
|
||||||
// {
|
// {
|
||||||
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
// todo rewrite?
|
// todo rewrite?
|
||||||
// todo DB
|
// todo DB
|
||||||
namespace NadekoBot.Modules.Games.Commands.Trivia
|
namespace NadekoBot.Modules.Games.Trivia
|
||||||
{
|
{
|
||||||
public class TriviaGame
|
public class TriviaGame
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
// THANKS @ShoMinamimoto for suggestions and coding help
|
// THANKS @ShoMinamimoto for suggestions and coding help
|
||||||
namespace NadekoBot.Modules.Games.Commands.Trivia
|
namespace NadekoBot.Modules.Games.Trivia
|
||||||
{
|
{
|
||||||
public class TriviaQuestion
|
public class TriviaQuestion
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Games.Commands.Trivia
|
namespace NadekoBot.Modules.Games.Trivia
|
||||||
{
|
{
|
||||||
public class TriviaQuestionPool
|
public class TriviaQuestionPool
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
using NadekoBot.Modules.Games.Commands.Trivia;
|
using NadekoBot.Modules.Games.Trivia;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
//todo Rewrite? Fix trivia not stopping bug
|
//todo Rewrite? Fix trivia not stopping bug
|
||||||
namespace NadekoBot.Modules.Games.Commands
|
namespace NadekoBot.Modules.Games
|
||||||
{
|
{
|
||||||
public partial class GamesModule
|
public partial class GamesModule
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Games
|
namespace NadekoBot.Modules.Games
|
||||||
{
|
{
|
||||||
@ -15,8 +16,9 @@ namespace NadekoBot.Modules.Games
|
|||||||
{
|
{
|
||||||
//todo DB
|
//todo DB
|
||||||
private IEnumerable<string> _8BallResponses;
|
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)
|
||||||
{
|
{
|
||||||
|
_8BallResponses = config.EightBallResponses;
|
||||||
}
|
}
|
||||||
|
|
||||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
|
@ -8,6 +8,7 @@ using NadekoBot.Attributes;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Help
|
namespace NadekoBot.Modules.Help
|
||||||
{
|
{
|
||||||
@ -20,7 +21,7 @@ namespace NadekoBot.Modules.Help
|
|||||||
return str + String.Format(str, NadekoBot.Credentials.ClientId);
|
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.Text.RegularExpressions;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.NSFW
|
namespace NadekoBot.Modules.NSFW
|
||||||
{
|
{
|
||||||
[Module("~", AppendSpace = false)]
|
[Module("~", AppendSpace = false)]
|
||||||
public class NSFW : DiscordModule
|
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 NadekoBot.Attributes;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Games.Commands
|
namespace NadekoBot.Modules.Games
|
||||||
{
|
{
|
||||||
[Module(">", AppendSpace = false)]
|
[Module(">", AppendSpace = false)]
|
||||||
public partial class Pokemon : DiscordModule
|
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;
|
//using System.Threading.Tasks;
|
||||||
|
|
||||||
//// todo RestSharp
|
//// todo RestSharp
|
||||||
//namespace NadekoBot.Modules.Searches.Commands
|
//namespace NadekoBot.Modules.Searches
|
||||||
//{
|
//{
|
||||||
// public partial class SearchesModule
|
// public partial class SearchesModule
|
||||||
// {
|
// {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
|
|
||||||
////todo Unit Conversion lib
|
////todo Unit Conversion lib
|
||||||
//namespace NadekoBot.Modules.Searches.Commands
|
//namespace NadekoBot.Modules.Searches
|
||||||
//{
|
//{
|
||||||
// class ConverterCommand : DiscordCommand
|
// class ConverterCommand : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
|
|
||||||
//todo mathos parser replacement
|
//todo mathos parser replacement
|
||||||
//namespace NadekoBot.Modules.Searches.Commands
|
//namespace NadekoBot.Modules.Searches
|
||||||
//{
|
//{
|
||||||
// class CalcCommand : DiscordCommand
|
// class CalcCommand : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NadekoBot.Modules.Searches.Commands.Models;
|
using NadekoBot.Modules.Searches.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
|||||||
* Last Updated: Feb, 2016
|
* Last Updated: Feb, 2016
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Searches.Commands.IMDB
|
namespace NadekoBot.Modules.Searches.IMDB
|
||||||
{
|
{
|
||||||
public static class ImdbScraper
|
public static class ImdbScraper
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
|||||||
public static async Task<string> GetIMDBId(string MovieName)
|
public static async Task<string> GetIMDBId(string MovieName)
|
||||||
{
|
{
|
||||||
string imdbUrl = await GetIMDbUrlAsync(System.Uri.EscapeUriString(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
|
//Get IMDb URL from search results
|
||||||
private static async Task<string> GetIMDbUrlAsync(string MovieName)
|
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)
|
private static async Task ParseIMDbPage(string imdbUrl, bool GetExtraInfo, ImdbMovie mov)
|
||||||
{
|
{
|
||||||
string html = await GetUrlDataAsync(imdbUrl + "combined");
|
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))
|
if (!string.IsNullOrEmpty(mov.Id))
|
||||||
{
|
{
|
||||||
mov.Status = true;
|
mov.Status = true;
|
||||||
mov.Title = match(@"<title>(IMDb \- )*(.*?) \(.*?</title>", html, 2);
|
mov.Title = Match(@"<title>(IMDb \- )*(.*?) \(.*?</title>", html, 2);
|
||||||
mov.OriginalTitle = match(@"title-extra"">(.*?)<", html);
|
mov.OriginalTitle = Match(@"title-extra"">(.*?)<", html);
|
||||||
mov.Year = match(@"<title>.*?\(.*?(\d{4}).*?).*?</title>", match(@"(<title>.*?</title>)", html));
|
mov.Year = Match(@"<title>.*?\(.*?(\d{4}).*?).*?</title>", Match(@"(<title>.*?</title>)", html));
|
||||||
mov.Rating = match(@"<b>(\d.\d)/10</b>", 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.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.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.Poster = Match(@"<div class=""photo"">.*?<a name=""poster"".*?><img.*?src=""(.*?)"".*?</div>", html);
|
||||||
if (!string.IsNullOrEmpty(mov.Poster) && mov.Poster.IndexOf("media-imdb.com") > 0)
|
if (!string.IsNullOrEmpty(mov.Poster) && mov.Poster.IndexOf("media-imdb.com") > 0)
|
||||||
{
|
{
|
||||||
mov.Poster = Regex.Replace(mov.Poster, @"_V1.*?.jpg", "_V1._SY200.jpg");
|
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>();
|
Dictionary<string, string> release = new Dictionary<string, string>();
|
||||||
string releasehtml = await GetUrlDataAsync("http://www.imdb.com/title/" + mov.Id + "/releaseinfo");
|
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);
|
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());
|
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;
|
//mov.ReleaseDates = release;
|
||||||
|
|
||||||
Dictionary<string, string> aka = new Dictionary<string, string>();
|
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)
|
foreach (string r in list)
|
||||||
{
|
{
|
||||||
Match rd = new Regex(@"\n*?.*?<td>(.*?)</td>\n*?.*?<td>(.*?)</td>", RegexOptions.Multiline).Match(r);
|
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>();
|
List<string> list = new List<string>();
|
||||||
string mediaurl = "http://www.imdb.com/title/" + mov.Id + "/mediaindex";
|
string mediaurl = "http://www.imdb.com/title/" + mov.Id + "/mediaindex";
|
||||||
string mediahtml = await GetUrlDataAsync(mediaurl);
|
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++)
|
for (int p = 1; p <= pagecount + 1; p++)
|
||||||
{
|
{
|
||||||
mediahtml = await GetUrlDataAsync(mediaurl + "?page=" + 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;
|
String image = m.Groups[1].Value;
|
||||||
list.Add(Regex.Replace(image, @"_V1\..*?.jpg", "_V1._SY0.jpg"));
|
list.Add(Regex.Replace(image, @"_V1\..*?.jpg", "_V1._SY0.jpg"));
|
||||||
@ -147,7 +147,7 @@ namespace NadekoBot.Modules.Searches.Commands.IMDB
|
|||||||
}
|
}
|
||||||
/*******************************[ Helper Methods ]********************************/
|
/*******************************[ Helper Methods ]********************************/
|
||||||
//Match single instance
|
//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();
|
return new Regex(regex, RegexOptions.Multiline).Match(html).Groups[i].Value.Trim();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
using NadekoBot.Modules.Searches.Commands.Models;
|
using NadekoBot.Modules.Searches.Models;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -11,22 +12,35 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Searches.Commands
|
namespace NadekoBot.Modules.Searches
|
||||||
{
|
{
|
||||||
public partial class SearchesModule
|
public partial class Searches
|
||||||
{
|
{
|
||||||
[Group]
|
[Group]
|
||||||
public class JokeCommands
|
public class JokeCommands
|
||||||
{
|
{
|
||||||
//todo DB
|
//todo DB
|
||||||
private List<WoWJoke> wowJokes;
|
private List<WoWJoke> wowJokes = new List<WoWJoke>();
|
||||||
private List<MagicItem> magicItems;
|
private List<MagicItem> magicItems;
|
||||||
|
private Logger _log;
|
||||||
|
|
||||||
public JokeCommands()
|
public JokeCommands()
|
||||||
|
{
|
||||||
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
|
if (File.Exists("data/wowjokes.json"))
|
||||||
{
|
{
|
||||||
wowJokes = JsonConvert.DeserializeObject<List<WoWJoke>>(File.ReadAllText("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"));
|
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]
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
|
@ -11,7 +11,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
//todo drawing
|
//todo drawing
|
||||||
namespace NadekoBot.Modules.Searches.Commands
|
namespace NadekoBot.Modules.Searches
|
||||||
{
|
{
|
||||||
public partial class Searches
|
public partial class Searches
|
||||||
{
|
{
|
||||||
|
@ -11,14 +11,10 @@ using NadekoBot.Attributes;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using NadekoBot.Extensions;
|
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]
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Memelist(IMessage imsg)
|
public async Task Memelist(IMessage imsg)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
namespace NadekoBot.Modules.Searches.Models
|
||||||
{
|
{
|
||||||
public class ImdbMovie
|
public class ImdbMovie
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
namespace NadekoBot.Modules.Searches.Models
|
||||||
{
|
{
|
||||||
class MagicItem
|
class MagicItem
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
namespace NadekoBot.Modules.Searches.Models
|
||||||
{
|
{
|
||||||
public class SearchPokemon
|
public class SearchPokemon
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
namespace NadekoBot.Modules.Searches.Models
|
||||||
{
|
{
|
||||||
public class WikipediaApiModel
|
public class WikipediaApiModel
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace NadekoBot.Modules.Searches.Commands.Models
|
namespace NadekoBot.Modules.Searches.Models
|
||||||
{
|
{
|
||||||
public class WoWJoke
|
public class WoWJoke
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
//using System.Text.RegularExpressions;
|
//using System.Text.RegularExpressions;
|
||||||
|
|
||||||
//todo DI into partials
|
//todo DI into partials
|
||||||
//namespace NadekoBot.Modules.Searches.Commands
|
//namespace NadekoBot.Modules.Searches
|
||||||
//{
|
//{
|
||||||
// internal class OsuCommands : DiscordCommand
|
// internal class OsuCommands : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
using NadekoBot.Modules.Searches.Commands.Models;
|
using NadekoBot.Modules.Searches.Models;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using NLog;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Searches.Commands
|
namespace NadekoBot.Modules.Searches
|
||||||
{
|
{
|
||||||
public partial class SearchesModule : DiscordModule
|
public partial class Searches
|
||||||
{
|
{
|
||||||
[Group]
|
[Group]
|
||||||
public class PokemonSearchCommands
|
public class PokemonSearchCommands
|
||||||
@ -21,12 +22,21 @@ namespace NadekoBot.Modules.Searches.Commands
|
|||||||
public const string PokemonAbilitiesFile = "data/pokemon/pokemon_abilities.json";
|
public const string PokemonAbilitiesFile = "data/pokemon/pokemon_abilities.json";
|
||||||
|
|
||||||
public const string PokemonListFile = "data/pokemon/pokemon_list.json";
|
public const string PokemonListFile = "data/pokemon/pokemon_list.json";
|
||||||
|
private Logger _log;
|
||||||
|
|
||||||
public PokemonSearchCommands()
|
public PokemonSearchCommands()
|
||||||
{
|
{
|
||||||
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
if (File.Exists(PokemonListFile))
|
if (File.Exists(PokemonListFile))
|
||||||
|
{
|
||||||
pokemons = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemon>>(File.ReadAllText(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));
|
pokemonAbilities = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemonAbility>>(File.ReadAllText(PokemonAbilitiesFile));
|
||||||
|
else
|
||||||
|
_log.Warn(PokemonAbilitiesFile + " is missing. Pokemon abilities not loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
//using System.Threading;
|
//using System.Threading;
|
||||||
|
|
||||||
//todo DB
|
//todo DB
|
||||||
//namespace NadekoBot.Modules.Searches.Commands
|
//namespace NadekoBot.Modules.Searches
|
||||||
//{
|
//{
|
||||||
// public partial class SearchesModule : DiscordModule
|
// public partial class Searches
|
||||||
// {
|
// {
|
||||||
// [Group]
|
// [Group]
|
||||||
// public class StreamNotificationCommands
|
// public class StreamNotificationCommands
|
||||||
@ -72,7 +72,7 @@
|
|||||||
// }, null, TimeSpan.Zero, TimeSpan.FromSeconds(15));
|
// }, 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;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Modules.Searches.Commands.IMDB;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
@ -12,8 +11,9 @@ using NadekoBot.Attributes;
|
|||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using NadekoBot.Modules.Searches.Commands.Models;
|
using Discord.WebSocket;
|
||||||
using NCalc;
|
using NadekoBot.Modules.Searches.Models;
|
||||||
|
using NadekoBot.Modules.Searches.IMDB;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Searches
|
namespace NadekoBot.Modules.Searches
|
||||||
{
|
{
|
||||||
@ -22,19 +22,10 @@ namespace NadekoBot.Modules.Searches
|
|||||||
{
|
{
|
||||||
private IYoutubeService _yt { get; }
|
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;
|
_yt = youtube;
|
||||||
}
|
}
|
||||||
|
|
||||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Calc(IMessage msg, [Remainder] string calculation)
|
|
||||||
{
|
|
||||||
var channel = msg.Channel as ITextChannel;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Weather(IMessage imsg, string city, string country)
|
public async Task Weather(IMessage imsg, string city, string country)
|
||||||
@ -257,7 +248,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
|
|
||||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task UrbanDictionary(IMessage imsg, [Remainder] string query = null)
|
public async Task Ud(IMessage imsg, [Remainder] string query = null)
|
||||||
{
|
{
|
||||||
var channel = imsg.Channel as ITextChannel;
|
var channel = imsg.Channel as ITextChannel;
|
||||||
|
|
||||||
|
@ -5,13 +5,14 @@ using NadekoBot.Extensions;
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Translator
|
namespace NadekoBot.Modules.Translator
|
||||||
{
|
{
|
||||||
[Module("~", AppendSpace = false)]
|
[Module("~", AppendSpace = false)]
|
||||||
public class Translator : DiscordModule
|
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.Text.RegularExpressions;
|
||||||
//using System.Timers;
|
//using System.Timers;
|
||||||
|
|
||||||
//namespace NadekoBot.Modules.Utility.Commands
|
//namespace NadekoBot.Modules.Utility
|
||||||
//{
|
//{
|
||||||
// class Remind : DiscordCommand
|
// class Remind : DiscordCommand
|
||||||
// {
|
// {
|
||||||
|
@ -10,6 +10,7 @@ using NadekoBot.Extensions;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Discord.WebSocket;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Utility
|
namespace NadekoBot.Modules.Utility
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[Module(".", AppendSpace = false)]
|
[Module(".", AppendSpace = false)]
|
||||||
public partial class Utility : DiscordModule
|
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();
|
var depMap = new DependencyMap();
|
||||||
depMap.Add<ILocalization>(Localizer);
|
depMap.Add<ILocalization>(Localizer);
|
||||||
depMap.Add<IBotConfiguration>(Config);
|
depMap.Add<IBotConfiguration>(Config);
|
||||||
depMap.Add<IDiscordClient>(Client);
|
depMap.Add<DiscordSocketClient>(Client);
|
||||||
depMap.Add<CommandService>(Commands);
|
depMap.Add<CommandService>(Commands);
|
||||||
depMap.Add<IYoutubeService>(Youtube);
|
depMap.Add<IYoutubeService>(Youtube);
|
||||||
|
|
||||||
|
36
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
36
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -575,27 +575,27 @@ namespace NadekoBot.Resources {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Shows a mentioned person's avatar..
|
/// Looks up a localized string similar to Shows a mentioned person's avatar..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string av_desc {
|
public static string avatar_desc {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("av_desc", resourceCulture);
|
return ResourceManager.GetString("avatar_desc", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to `~av "@SomeGuy"`.
|
/// Looks up a localized string similar to `~av "@SomeGuy"`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string av_summary {
|
public static string avatar_summary {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("av_summary", resourceCulture);
|
return ResourceManager.GetString("avatar_summary", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to av.
|
/// Looks up a localized string similar to av.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string av_text {
|
public static string avatar_text {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("av_text", resourceCulture);
|
return ResourceManager.GetString("avatar_text", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7406,27 +7406,27 @@ namespace NadekoBot.Resources {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Shows weather data for a specified city and a country. BOTH ARE REQUIRED. Use country abbrevations..
|
/// Looks up a localized string similar to Shows weather data for a specified city and a country. BOTH ARE REQUIRED. Use country abbrevations..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string we_desc {
|
public static string weather_desc {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("we_desc", resourceCulture);
|
return ResourceManager.GetString("weather_desc", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to `~we Moscow RF`.
|
/// Looks up a localized string similar to `~we Moscow RF`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string we_summary {
|
public static string weather_summary {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("we_summary", resourceCulture);
|
return ResourceManager.GetString("weather_summary", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to we.
|
/// Looks up a localized string similar to we.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string we_text {
|
public static string weather_text {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("we_text", resourceCulture);
|
return ResourceManager.GetString("weather_text", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7541,27 +7541,27 @@ namespace NadekoBot.Resources {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Searches youtubes and shows the first result.
|
/// Looks up a localized string similar to Searches youtubes and shows the first result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string yt_desc {
|
public static string youtube_desc {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("yt_desc", resourceCulture);
|
return ResourceManager.GetString("youtube_desc", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to `~yt query`.
|
/// Looks up a localized string similar to `~yt query`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string yt_summary {
|
public static string youtube_summary {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("yt_summary", resourceCulture);
|
return ResourceManager.GetString("youtube_summary", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to yt.
|
/// Looks up a localized string similar to yt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string yt_text {
|
public static string youtube_text {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("yt_text", resourceCulture);
|
return ResourceManager.GetString("youtube_text", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2115,22 +2115,22 @@
|
|||||||
<data name="memegen_summary" xml:space="preserve">
|
<data name="memegen_summary" xml:space="preserve">
|
||||||
<value>`~memegen biw "gets iced coffee" "in the winter"`</value>
|
<value>`~memegen biw "gets iced coffee" "in the winter"`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="we_text" xml:space="preserve">
|
<data name="weather_text" xml:space="preserve">
|
||||||
<value>we</value>
|
<value>we</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="we_desc" xml:space="preserve">
|
<data name="weather_desc" xml:space="preserve">
|
||||||
<value>Shows weather data for a specified city and a country. BOTH ARE REQUIRED. Use country abbrevations.</value>
|
<value>Shows weather data for a specified city and a country. BOTH ARE REQUIRED. Use country abbrevations.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="we_summary" xml:space="preserve">
|
<data name="weather_summary" xml:space="preserve">
|
||||||
<value>`~we Moscow RF`</value>
|
<value>`~we Moscow RF`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="yt_text" xml:space="preserve">
|
<data name="youtube_text" xml:space="preserve">
|
||||||
<value>yt</value>
|
<value>yt</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="yt_desc" xml:space="preserve">
|
<data name="youtube_desc" xml:space="preserve">
|
||||||
<value>Searches youtubes and shows the first result</value>
|
<value>Searches youtubes and shows the first result</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="yt_summary" xml:space="preserve">
|
<data name="youtube_summary" xml:space="preserve">
|
||||||
<value>`~yt query`</value>
|
<value>`~yt query`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ani_text" xml:space="preserve">
|
<data name="ani_text" xml:space="preserve">
|
||||||
@ -2349,13 +2349,13 @@
|
|||||||
<data name="videocall_summary" xml:space="preserve">
|
<data name="videocall_summary" xml:space="preserve">
|
||||||
<value>`~videocall "@SomeGuy"`</value>
|
<value>`~videocall "@SomeGuy"`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="av_text" xml:space="preserve">
|
<data name="avatar_text" xml:space="preserve">
|
||||||
<value>av</value>
|
<value>av</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="av_desc" xml:space="preserve">
|
<data name="avatar_desc" xml:space="preserve">
|
||||||
<value>Shows a mentioned person's avatar.</value>
|
<value>Shows a mentioned person's avatar.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="av_summary" xml:space="preserve">
|
<data name="avatar_summary" xml:space="preserve">
|
||||||
<value>`~av "@SomeGuy"`</value>
|
<value>`~av "@SomeGuy"`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="hentai_text" xml:space="preserve">
|
<data name="hentai_text" xml:space="preserve">
|
||||||
|
@ -4,12 +4,15 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Discord;
|
using Discord;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
namespace NadekoBot.Services.Impl
|
namespace NadekoBot.Services.Impl
|
||||||
{
|
{
|
||||||
//todo load creds
|
//todo load creds
|
||||||
public class BotCredentials : IBotCredentials
|
public class BotCredentials : IBotCredentials
|
||||||
{
|
{
|
||||||
|
private Logger _log;
|
||||||
|
|
||||||
public string ClientId { get; }
|
public string ClientId { get; }
|
||||||
|
|
||||||
public string GoogleApiKey { get; }
|
public string GoogleApiKey { get; }
|
||||||
@ -23,12 +26,18 @@ namespace NadekoBot.Services.Impl
|
|||||||
public string LoLApiKey { get; }
|
public string LoLApiKey { get; }
|
||||||
|
|
||||||
public BotCredentials()
|
public BotCredentials()
|
||||||
|
{
|
||||||
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
|
if (File.Exists("./credentials.json"))
|
||||||
{
|
{
|
||||||
var cm = JsonConvert.DeserializeObject<CredentialsModel>(File.ReadAllText("./credentials.json"));
|
var cm = JsonConvert.DeserializeObject<CredentialsModel>(File.ReadAllText("./credentials.json"));
|
||||||
Token = cm.Token;
|
Token = cm.Token;
|
||||||
OwnerIds = cm.OwnerIds;
|
OwnerIds = cm.OwnerIds;
|
||||||
LoLApiKey = cm.LoLApiKey;
|
LoLApiKey = cm.LoLApiKey;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
_log.Fatal("credentials.json is missing. Failed to start.");
|
||||||
|
}
|
||||||
|
|
||||||
private class CredentialsModel {
|
private class CredentialsModel {
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
@ -5,7 +5,7 @@ using NadekoBot.Modules.Permissions.Classes;
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Permissions.Commands
|
namespace NadekoBot.Modules.Permissions
|
||||||
{
|
{
|
||||||
internal class FilterInvitesCommand : DiscordCommand
|
internal class FilterInvitesCommand : DiscordCommand
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ using NadekoBot.Modules.Permissions.Classes;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Permissions.Commands
|
namespace NadekoBot.Modules.Permissions
|
||||||
{
|
{
|
||||||
internal class FilterWords : DiscordCommand
|
internal class FilterWords : DiscordCommand
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"description": "General purposee Discord bot written in C#.",
|
"description": "General purpose Discord bot written in C#.",
|
||||||
"authors": [ "Kwoth" ],
|
"authors": [ "Kwoth" ],
|
||||||
"copyright": "Kwoth",
|
"copyright": "Kwoth",
|
||||||
"buildOptions": {
|
"buildOptions": {
|
||||||
|
Loading…
Reference in New Issue
Block a user