A lot of fixes to constructors

This commit is contained in:
Kwoth 2017-01-01 13:57:38 +01:00
parent d0e7a0c404
commit 2d2a7f765f
16 changed files with 38 additions and 104 deletions

View File

@ -29,10 +29,6 @@ namespace NadekoBot.Modules.Administration
private new static Logger _log { get; } private new static Logger _log { get; }
public Administration() : base()
{
}
static Administration() static Administration()
{ {
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();

View File

@ -67,10 +67,7 @@ namespace NadekoBot.Modules.Administration
sw.Stop(); sw.Stop();
_log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s"); _log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s");
}
public LogCommands()
{
//_client.MessageReceived += _client_MessageReceived; //_client.MessageReceived += _client_MessageReceived;
_client.MessageUpdated += _client_MessageUpdated; _client.MessageUpdated += _client_MessageUpdated;
_client.MessageDeleted += _client_MessageDeleted; _client.MessageDeleted += _client_MessageDeleted;
@ -91,7 +88,7 @@ namespace NadekoBot.Modules.Administration
MuteCommands.UserUnmuted += MuteCommands_UserUnmuted; MuteCommands.UserUnmuted += MuteCommands_UserUnmuted;
} }
private async void _client_UserVoiceStateUpdated_TTS(SocketUser iusr, SocketVoiceState before, SocketVoiceState after) private static async void _client_UserVoiceStateUpdated_TTS(SocketUser iusr, SocketVoiceState before, SocketVoiceState after)
{ {
try try
{ {
@ -133,7 +130,7 @@ namespace NadekoBot.Modules.Administration
catch { } catch { }
} }
private async void MuteCommands_UserMuted(IGuildUser usr, MuteCommands.MuteType muteType) private static async void MuteCommands_UserMuted(IGuildUser usr, MuteCommands.MuteType muteType)
{ {
try try
{ {
@ -163,7 +160,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void MuteCommands_UserUnmuted(IGuildUser usr, MuteCommands.MuteType muteType) private static async void MuteCommands_UserUnmuted(IGuildUser usr, MuteCommands.MuteType muteType)
{ {
try try
{ {
@ -226,13 +223,12 @@ namespace NadekoBot.Modules.Administration
//punishment = "BANNED"; //punishment = "BANNED";
} }
await logChannel.SendMessageAsync(String.Join("\n", users.Select(user => $"‼️ {Format.Bold(user.ToString())} got **{punishment}** due to __**{protection}**__ protection on **{user.Guild.Name}** server."))) await logChannel.SendMessageAsync(String.Join("\n", users.Select(user => $"‼️ {Format.Bold(user.ToString())} got **{punishment}** due to __**{protection}**__ protection on **{user.Guild.Name}** server.")))
//await logChannel.SendMessageAsync(String.Join("\n",users.Select(user=>$"{Format.Bold(user.ToString())} was **{punishment}** due to `{protection}` protection on **{user.Guild.Name}** server.")))
.ConfigureAwait(false); .ConfigureAwait(false);
} }
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_UserUpdated(SocketUser uBefore, SocketUser uAfter) private static async void _client_UserUpdated(SocketUser uBefore, SocketUser uAfter)
{ {
try try
{ {
@ -254,26 +250,21 @@ namespace NadekoBot.Modules.Administration
string str = $"🕔`{prettyCurrentTime}`"; string str = $"🕔`{prettyCurrentTime}`";
if (before.Username != after.Username) if (before.Username != after.Username)
//str += $"**Name Changed**`{before.Username}#{before.Discriminator}`\n\t\t`New:`{after.ToString()}`";
str += $"👤__**{before.Username}#{before.Discriminator}**__ **| Name Changed |** 🆔 `{before.Id}`\n\t\t`New:` **{after.ToString()}**"; str += $"👤__**{before.Username}#{before.Discriminator}**__ **| Name Changed |** 🆔 `{before.Id}`\n\t\t`New:` **{after.ToString()}**";
else if (before.Nickname != after.Nickname) else if (before.Nickname != after.Nickname)
str += $"👤__**{before.Username}#{before.Discriminator}**__ **| Nickname Changed |** 🆔 `{before.Id}`\n\t\t`Old:` **{before.Nickname}#{before.Discriminator}**\n\t\t`New:` **{after.Nickname}#{after.Discriminator}**"; str += $"👤__**{before.Username}#{before.Discriminator}**__ **| Nickname Changed |** 🆔 `{before.Id}`\n\t\t`Old:` **{before.Nickname}#{before.Discriminator}**\n\t\t`New:` **{after.Nickname}#{after.Discriminator}**";
//str += $"**Nickname Changed**`{before.Username}#{before.Discriminator}`\n\t\t`Old:` {before.Nickname}#{before.Discriminator}\n\t\t`New:` {after.Nickname}#{after.Discriminator}";
else if (before.AvatarUrl != after.AvatarUrl) else if (before.AvatarUrl != after.AvatarUrl)
//str += $"**Avatar Changed**👤`{before.Username}#{before.Discriminator}`\n\t {await _google.ShortenUrl(before.AvatarUrl)} `=>` {await _google.ShortenUrl(after.AvatarUrl)}"; str += $"👤__**{before.Username}#{before.Discriminator}**__ **| Avatar Changed |** 🆔 `{before.Id}`\n\t🖼 {await NadekoBot.Google.ShortenUrl(before.AvatarUrl)} `=>` {await NadekoBot.Google.ShortenUrl(after.AvatarUrl)}";
str += $"👤__**{before.Username}#{before.Discriminator}**__ **| Avatar Changed |** 🆔 `{before.Id}`\n\t🖼 {await _google.ShortenUrl(before.AvatarUrl)} `=>` {await _google.ShortenUrl(after.AvatarUrl)}";
else if (!before.RoleIds.SequenceEqual(after.RoleIds)) else if (!before.RoleIds.SequenceEqual(after.RoleIds))
{ {
if (before.RoleIds.Count < after.RoleIds.Count) if (before.RoleIds.Count < after.RoleIds.Count)
{ {
var diffRoles = after.RoleIds.Where(r => !before.RoleIds.Contains(r)).Select(r => "**" + before.Guild.GetRole(r).Name + "**"); var diffRoles = after.RoleIds.Where(r => !before.RoleIds.Contains(r)).Select(r => "**" + before.Guild.GetRole(r).Name + "**");
//str += $"**User's Roles changed ⚔➕**👤`{before.ToString()}`\n\tNow has {string.Join(", ", diffRoles)} role.";
str += $"👤__**{before.ToString()}**__ **| User's Role Added |** 🆔 `{before.Id}`\n\t✅ {string.Join(", ", diffRoles).SanitizeMentions()}\n\t\t⚔ **`{string.Join(", ", after.GetRoles().Select(r => r.Name)).SanitizeMentions()}`** ⚔"; str += $"👤__**{before.ToString()}**__ **| User's Role Added |** 🆔 `{before.Id}`\n\t✅ {string.Join(", ", diffRoles).SanitizeMentions()}\n\t\t⚔ **`{string.Join(", ", after.GetRoles().Select(r => r.Name)).SanitizeMentions()}`** ⚔";
} }
else if (before.RoleIds.Count > after.RoleIds.Count) else if (before.RoleIds.Count > after.RoleIds.Count)
{ {
var diffRoles = before.RoleIds.Where(r => !after.RoleIds.Contains(r)).Select(r => "**" + before.Guild.GetRole(r).Name + "**"); var diffRoles = before.RoleIds.Where(r => !after.RoleIds.Contains(r)).Select(r => "**" + before.Guild.GetRole(r).Name + "**");
//str += $"**User's Roles changed **`{before.ToString()}`\n\tNo longer has {string.Join(", ", diffRoles)} role.";
str += $"👤__**{before.ToString()}**__ **| User's Role Removed |** 🆔 `{before.Id}`\n\t🚮 {string.Join(", ", diffRoles).SanitizeMentions()}\n\t\t⚔ **`{string.Join(", ", after.GetRoles().Select(r => r.Name)).SanitizeMentions()}`** ⚔"; str += $"👤__**{before.ToString()}**__ **| User's Role Removed |** 🆔 `{before.Id}`\n\t🚮 {string.Join(", ", diffRoles).SanitizeMentions()}\n\t\t⚔ **`{string.Join(", ", after.GetRoles().Select(r => r.Name)).SanitizeMentions()}`** ⚔";
} }
} }
@ -284,7 +275,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_ChannelUpdated(IChannel cbefore, IChannel cafter) private static async void _client_ChannelUpdated(IChannel cbefore, IChannel cafter)
{ {
try try
{ {
@ -303,12 +294,10 @@ namespace NadekoBot.Modules.Administration
if ((logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.ChannelUpdated)) == null) if ((logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.ChannelUpdated)) == null)
return; return;
if (before.Name != after.Name) if (before.Name != after.Name)
//await logChannel.SendMessageAsync($@"`{prettyCurrentTime}` **Channel Name Changed** `#{after.Name}` ({after.Id})
await logChannel.SendMessageAsync($@"🕓`{prettyCurrentTime}` **| Channel Name Changed |** #⃣ `{after.Name} ({after.Id})` await logChannel.SendMessageAsync($@"🕓`{prettyCurrentTime}` **| Channel Name Changed |** #⃣ `{after.Name} ({after.Id})`
`Old:` {before.Name} `Old:` {before.Name}
**`New:`** {after.Name}").ConfigureAwait(false); **`New:`** {after.Name}").ConfigureAwait(false);
else if ((before as ITextChannel).Topic != (after as ITextChannel).Topic) else if ((before as ITextChannel).Topic != (after as ITextChannel).Topic)
//await logChannel.SendMessageAsync($@"`{prettyCurrentTime}` **Channel Topic Changed** `#{after.Name}` ({after.Id})
await logChannel.SendMessageAsync($@"🕘`{prettyCurrentTime}` **| Channel Topic Changed |** #⃣ `{after.Name} ({after.Id})` await logChannel.SendMessageAsync($@"🕘`{prettyCurrentTime}` **| Channel Topic Changed |** #⃣ `{after.Name} ({after.Id})`
`Old:` {((ITextChannel)before).Topic} `Old:` {((ITextChannel)before).Topic}
**`New:`** {((ITextChannel)after).Topic}").ConfigureAwait(false); **`New:`** {((ITextChannel)after).Topic}").ConfigureAwait(false);
@ -316,7 +305,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_ChannelDestroyed(IChannel ich) private static async void _client_ChannelDestroyed(IChannel ich)
{ {
try try
{ {
@ -339,7 +328,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_ChannelCreated(IChannel ich) private static async void _client_ChannelCreated(IChannel ich)
{ {
try try
{ {
@ -361,7 +350,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_UserVoiceStateUpdated(SocketUser iusr, SocketVoiceState before, SocketVoiceState after) private static async void _client_UserVoiceStateUpdated(SocketUser iusr, SocketVoiceState before, SocketVoiceState after)
{ {
try try
{ {
@ -406,7 +395,7 @@ namespace NadekoBot.Modules.Administration
} }
} }
private async void _client_UserPresenceUpdated(Optional<SocketGuild> optGuild, SocketUser usr, SocketPresence before, SocketPresence after) private static async void _client_UserPresenceUpdated(Optional<SocketGuild> optGuild, SocketUser usr, SocketPresence before, SocketPresence after)
{ {
try try
{ {
@ -435,7 +424,7 @@ namespace NadekoBot.Modules.Administration
catch { } catch { }
} }
private async void _client_UserLeft(IGuildUser usr) private static async void _client_UserLeft(IGuildUser usr)
{ {
try try
{ {
@ -452,7 +441,7 @@ namespace NadekoBot.Modules.Administration
catch { } catch { }
} }
private async void _client_UserJoined(IGuildUser usr) private static async void _client_UserJoined(IGuildUser usr)
{ {
try try
{ {
@ -470,7 +459,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_UserUnbanned(IUser usr, IGuild guild) private static async void _client_UserUnbanned(IUser usr, IGuild guild)
{ {
try try
{ {
@ -488,7 +477,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_UserBanned(IUser usr, IGuild guild) private static async void _client_UserBanned(IUser usr, IGuild guild)
{ {
try try
{ {
@ -505,7 +494,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_MessageDeleted(ulong arg1, Optional<SocketMessage> imsg) private static async void _client_MessageDeleted(ulong arg1, Optional<SocketMessage> imsg)
{ {
try try
@ -536,7 +525,7 @@ namespace NadekoBot.Modules.Administration
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
} }
private async void _client_MessageUpdated(Optional<SocketMessage> optmsg, SocketMessage imsg2) private static async void _client_MessageUpdated(Optional<SocketMessage> optmsg, SocketMessage imsg2)
{ {
try try
{ {

View File

@ -24,9 +24,9 @@ namespace NadekoBot.Modules.Administration
{ {
private const int CURRENT_VERSION = 1; private const int CURRENT_VERSION = 1;
private Logger _log { get; } private static Logger _log { get; }
public Migration() static Migration()
{ {
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
} }

View File

@ -11,28 +11,21 @@ namespace NadekoBot.Modules.Administration
[Group] [Group]
class SelfCommands : ModuleBase class SelfCommands : ModuleBase
{ {
private ShardedDiscordClient _client;
public SelfCommands()
{
this._client = NadekoBot.Client;
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[OwnerOnly] [OwnerOnly]
public async Task Leave([Remainder] string guildStr) public async Task Leave([Remainder] string guildStr)
{ {
guildStr = guildStr.Trim().ToUpperInvariant(); guildStr = guildStr.Trim().ToUpperInvariant();
var server = _client.GetGuilds().FirstOrDefault(g => g.Id.ToString().Trim().ToUpperInvariant() == guildStr) ?? var server = NadekoBot.Client.GetGuilds().FirstOrDefault(g => g.Id.ToString().Trim().ToUpperInvariant() == guildStr) ??
_client.GetGuilds().FirstOrDefault(g => g.Name.Trim().ToUpperInvariant() == guildStr); NadekoBot.Client.GetGuilds().FirstOrDefault(g => g.Name.Trim().ToUpperInvariant() == guildStr);
if (server == null) if (server == null)
{ {
await Context.Channel.SendErrorAsync("⚠️ Cannot find that server").ConfigureAwait(false); await Context.Channel.SendErrorAsync("⚠️ Cannot find that server").ConfigureAwait(false);
return; return;
} }
if (server.OwnerId != _client.CurrentUser().Id) if (server.OwnerId != NadekoBot.Client.CurrentUser().Id)
{ {
await server.LeaveAsync().ConfigureAwait(false); await server.LeaveAsync().ConfigureAwait(false);
await Context.Channel.SendConfirmAsync("✅ Left server " + server.Name).ConfigureAwait(false); await Context.Channel.SendConfirmAsync("✅ Left server " + server.Name).ConfigureAwait(false);

View File

@ -36,9 +36,6 @@ namespace NadekoBot.Modules.CustomReactions
sw.Stop(); sw.Stop();
_log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s"); _log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s");
} }
public CustomReactions() : base()
{
}
public void ClearStats() => ReactionStats.Clear(); public void ClearStats() => ReactionStats.Clear();

View File

@ -21,14 +21,7 @@ namespace NadekoBot.Modules.Gambling
{ {
private static readonly ConcurrentDictionary<IGuild, Cards> AllDecks = new ConcurrentDictionary<IGuild, Cards>(); private static readonly ConcurrentDictionary<IGuild, Cards> AllDecks = new ConcurrentDictionary<IGuild, Cards>();
public DrawCommands()
{
_log = LogManager.GetCurrentClassLogger();
}
private const string cardsPath = "data/images/cards"; private const string cardsPath = "data/images/cards";
private Logger _log { get; }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
@ -42,7 +35,7 @@ namespace NadekoBot.Modules.Gambling
{ {
if (cards.CardPool.Count == 0 && i != 0) if (cards.CardPool.Count == 0 && i != 0)
{ {
try { await Context.Channel.SendErrorAsync("No more cards in a deck.").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } try { await Context.Channel.SendErrorAsync("No more cards in a deck.").ConfigureAwait(false); } catch { }
break; break;
} }
var currentCard = cards.DrawACard(); var currentCard = cards.DrawACard();

View File

@ -18,15 +18,11 @@ namespace NadekoBot.Modules.Games
//channelId, game //channelId, game
public static ConcurrentDictionary<ulong, HangmanGame> HangmanGames { get; } = new ConcurrentDictionary<ulong, HangmanGame>(); public static ConcurrentDictionary<ulong, HangmanGame> HangmanGames { get; } = new ConcurrentDictionary<ulong, HangmanGame>();
private static string typesStr { get; } = "";
static HangmanCommands() static HangmanCommands()
{ {
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
}
string typesStr { get; } = "";
public HangmanCommands()
{
typesStr = $"`List of \"{NadekoBot.ModulePrefixes[typeof(Games).Name]}hangman\" term types:`\n" + String.Join(", ", Enum.GetNames(typeof(HangmanTermPool.HangmanTermType))); typesStr = $"`List of \"{NadekoBot.ModulePrefixes[typeof(Games).Name]}hangman\" term types:`\n" + String.Join(", ", Enum.GetNames(typeof(HangmanTermPool.HangmanTermType)));
} }

View File

@ -148,7 +148,6 @@ namespace NadekoBot.Modules.Games
[Group] [Group]
public class SpeedTypingCommands : ModuleBase public class SpeedTypingCommands : ModuleBase
{ {
public static List<TypingArticle> TypingArticles { get; } = new List<TypingArticle>(); public static List<TypingArticle> TypingArticles { get; } = new List<TypingArticle>();
const string typingArticlesPath = "data/typing_articles.json"; const string typingArticlesPath = "data/typing_articles.json";
@ -157,12 +156,7 @@ namespace NadekoBot.Modules.Games
{ {
try { TypingArticles = JsonConvert.DeserializeObject<List<TypingArticle>>(File.ReadAllText(typingArticlesPath)); } catch { } try { TypingArticles = JsonConvert.DeserializeObject<List<TypingArticle>>(File.ReadAllText(typingArticlesPath)); } catch { }
} }
public static ConcurrentDictionary<ulong, TypingGame> RunningContests; public static ConcurrentDictionary<ulong, TypingGame> RunningContests = new ConcurrentDictionary<ulong, TypingGame>();
public SpeedTypingCommands()
{
RunningContests = new ConcurrentDictionary<ulong, TypingGame>();
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]

View File

@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Music
public const string MusicDataPath = "data/musicdata"; public const string MusicDataPath = "data/musicdata";
public Music() : base() static Music()
{ {
//it can fail if its currenctly opened or doesn't exist. Either way i don't care //it can fail if its currenctly opened or doesn't exist. Either way i don't care
try { Directory.Delete(MusicDataPath, true); } catch { } try { Directory.Delete(MusicDataPath, true); } catch { }
@ -37,7 +37,7 @@ namespace NadekoBot.Modules.Music
Directory.CreateDirectory(MusicDataPath); Directory.CreateDirectory(MusicDataPath);
} }
private async void Client_UserVoiceStateUpdated(SocketUser iusr, SocketVoiceState oldState, SocketVoiceState newState) private static async void Client_UserVoiceStateUpdated(SocketUser iusr, SocketVoiceState oldState, SocketVoiceState newState)
{ {
var usr = iusr as SocketGuildUser; var usr = iusr as SocketGuildUser;
if (usr == null || if (usr == null ||
@ -60,10 +60,7 @@ namespace NadekoBot.Modules.Music
player.TogglePause(); player.TogglePause();
} }
} }
catch (Exception ex) catch { }
{
_log.Warn(ex);
}
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]

View File

@ -22,10 +22,6 @@ namespace NadekoBot.Modules.NSFW
//ulong/cancel //ulong/cancel
private static ConcurrentDictionary<ulong, Timer> AutoHentaiTimers { get; } = new ConcurrentDictionary<ulong, Timer>(); private static ConcurrentDictionary<ulong, Timer> AutoHentaiTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
public NSFW() : base()
{
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Hentai([Remainder] string tag = null) public async Task Hentai([Remainder] string tag = null)

View File

@ -49,10 +49,6 @@ namespace NadekoBot.Modules.Permissions
_log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s"); _log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s");
} }
public Permissions() : base()
{
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Verbose(PermissionAction action) public async Task Verbose(PermissionAction action)

View File

@ -24,18 +24,18 @@ namespace NadekoBot.Modules.Pokemon
public const string PokemonTypesFile = "data/pokemon_types.json"; public const string PokemonTypesFile = "data/pokemon_types.json";
private Logger _pokelog { get; } private static new Logger _log { get; }
public Pokemon() : base() static Pokemon()
{ {
_pokelog = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
if (File.Exists(PokemonTypesFile)) if (File.Exists(PokemonTypesFile))
{ {
PokemonTypes = JsonConvert.DeserializeObject<List<PokemonType>>(File.ReadAllText(PokemonTypesFile)); PokemonTypes = JsonConvert.DeserializeObject<List<PokemonType>>(File.ReadAllText(PokemonTypesFile));
} }
else else
{ {
_pokelog.Warn(PokemonTypesFile + " is missing. Pokemon types not loaded."); _log.Warn(PokemonTypesFile + " is missing. Pokemon types not loaded.");
} }
} }

View File

@ -12,11 +12,7 @@ namespace NadekoBot.Modules.Searches
[Group] [Group]
public class PlaceCommands : ModuleBase public class PlaceCommands : ModuleBase
{ {
string typesStr { get; } = ""; private static string typesStr { get; } = $"`List of \"{NadekoBot.ModulePrefixes[typeof(Searches).Name]}place\" tags:`\n" + String.Join(", ", Enum.GetNames(typeof(PlaceType)));
public PlaceCommands()
{
typesStr = $"`List of \"{NadekoBot.ModulePrefixes[typeof(Searches).Name]}place\" tags:`\n" + String.Join(", ", Enum.GetNames(typeof(PlaceType)));
}
public enum PlaceType public enum PlaceType
{ {

View File

@ -22,17 +22,17 @@ namespace NadekoBot.Modules.Utility
Regex regex = new Regex(@"^(?:(?<months>\d)mo)?(?:(?<weeks>\d)w)?(?:(?<days>\d{1,2})d)?(?:(?<hours>\d{1,2})h)?(?:(?<minutes>\d{1,2})m)?$", Regex regex = new Regex(@"^(?:(?<months>\d)mo)?(?:(?<weeks>\d)w)?(?:(?<days>\d{1,2})d)?(?:(?<hours>\d{1,2})h)?(?:(?<minutes>\d{1,2})m)?$",
RegexOptions.Compiled | RegexOptions.Multiline); RegexOptions.Compiled | RegexOptions.Multiline);
private string RemindMessageFormat { get; } private static string RemindMessageFormat { get; }
IDictionary<string, Func<Reminder, string>> replacements = new Dictionary<string, Func<Reminder, string>> private static IDictionary<string, Func<Reminder, string>> replacements = new Dictionary<string, Func<Reminder, string>>
{ {
{ "%message%" , (r) => r.Message }, { "%message%" , (r) => r.Message },
{ "%user%", (r) => $"<@!{r.UserId}>" }, { "%user%", (r) => $"<@!{r.UserId}>" },
{ "%target%", (r) => r.IsPrivate ? "Direct Message" : $"<#{r.ChannelId}>"} { "%target%", (r) => r.IsPrivate ? "Direct Message" : $"<#{r.ChannelId}>"}
}; };
private Logger _log { get; } private static Logger _log { get; }
public RemindCommands() static RemindCommands()
{ {
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
List<Reminder> reminders; List<Reminder> reminders;
@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Utility
} }
} }
private async Task StartReminder(Reminder r) private static async Task StartReminder(Reminder r)
{ {
var now = DateTime.Now; var now = DateTime.Now;
var twoMins = new TimeSpan(0, 2, 0); var twoMins = new TimeSpan(0, 2, 0);

View File

@ -54,15 +54,11 @@ namespace NadekoBot.Modules.Utility
{ {
_log.Warn("Could not load units: " + e.Message); _log.Warn("Could not load units: " + e.Message);
} }
}
public UnitConverterCommands()
{
_timer = new Timer(async (obj) => await UpdateCurrency(), null, (int)updateInterval.TotalMilliseconds, (int)updateInterval.TotalMilliseconds); _timer = new Timer(async (obj) => await UpdateCurrency(), null, (int)updateInterval.TotalMilliseconds, (int)updateInterval.TotalMilliseconds);
} }
public async Task UpdateCurrency() public static async Task UpdateCurrency()
{ {
try try
{ {

View File

@ -16,11 +16,6 @@ namespace NadekoBot.Modules.Utility
[NadekoModule("Utility", ".")] [NadekoModule("Utility", ".")]
public partial class Utility : DiscordModule public partial class Utility : DiscordModule
{ {
public Utility() : base()
{
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task TogetherTube() public async Task TogetherTube()