a few fixes due to discord.net breaking changes /s
This commit is contained in:
		| @@ -1,12 +1,11 @@ | ||||
| using System.Threading.Tasks; | ||||
| using Discord.Commands; | ||||
| using Discord; | ||||
| //using System.Threading.Tasks; | ||||
| //using Discord.Commands; | ||||
| //using Discord; | ||||
|  | ||||
| namespace NadekoBot.Attributes { | ||||
|     public class OwnerOnlyAttribute : PreconditionAttribute | ||||
|     { | ||||
|  | ||||
|         public override Task<PreconditionResult> CheckPermissions(IMessage context, Command executingCommand, object moduleInstance) =>  | ||||
|             Task.FromResult((NadekoBot.Credentials.IsOwner(context.Author) ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner"))); | ||||
|     } | ||||
| } | ||||
| //namespace NadekoBot.Attributes { | ||||
| //    public class OwnerOnlyAttribute : PreconditionAttribute | ||||
| //    { | ||||
| //        public override Task<PreconditionResult> CheckPermissions(IUserMessage context, Command executingCommand, object moduleInstance) =>  | ||||
| //            Task.FromResult((NadekoBot.Credentials.IsOwner(context.Author) ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner"))); | ||||
| //    } | ||||
| //} | ||||
| @@ -27,9 +27,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Restart(IMessage imsg) | ||||
|         //public async Task Restart(IUserMessage umsg) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    await channel.SendMessageAsync("`Restarting in 2 seconds...`"); | ||||
|         //    await Task.Delay(2000); | ||||
| @@ -40,9 +40,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.Administrator)] | ||||
|         public async Task Delmsgoncmd(IMessage imsg) | ||||
|         public async Task Delmsgoncmd(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             GuildConfig conf; | ||||
|             using (var uow = DbHandler.UnitOfWork()) | ||||
|             { | ||||
| @@ -60,9 +60,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageRoles)] | ||||
|         public async Task Setrole(IMessage imsg, IGuildUser usr, [Remainder] IRole role) | ||||
|         public async Task Setrole(IUserMessage umsg, IGuildUser usr, [Remainder] IRole role) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             try | ||||
|             { | ||||
|                 await usr.AddRolesAsync(role).ConfigureAwait(false); | ||||
| @@ -78,9 +78,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageRoles)] | ||||
|         public async Task Removerole(IMessage imsg, IGuildUser usr, [Remainder] IRole role) | ||||
|         public async Task Removerole(IUserMessage umsg, IGuildUser usr, [Remainder] IRole role) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             try | ||||
|             { | ||||
|                 await usr.RemoveRolesAsync(role).ConfigureAwait(false); | ||||
| @@ -95,9 +95,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageRoles)] | ||||
|         public async Task RenameRole(IMessage imsg, IRole roleToEdit, string newname) | ||||
|         public async Task RenameRole(IUserMessage umsg, IRole roleToEdit, string newname) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             try | ||||
|             { | ||||
|                 if (roleToEdit.Position > (await channel.Guild.GetCurrentUserAsync().ConfigureAwait(false)).Roles.Max(r => r.Position)) | ||||
| @@ -117,9 +117,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageRoles)] | ||||
|         public async Task RemoveAllRoles(IMessage imsg, [Remainder] IGuildUser user) | ||||
|         public async Task RemoveAllRoles(IUserMessage umsg, [Remainder] IGuildUser user) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             try | ||||
|             { | ||||
| @@ -135,9 +135,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageRoles)] | ||||
|         public async Task CreateRole(IMessage imsg, [Remainder] string roleName = null) | ||||
|         public async Task CreateRole(IUserMessage umsg, [Remainder] string roleName = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(roleName)) | ||||
| @@ -156,9 +156,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageRoles)] | ||||
|         public async Task RoleColor(IMessage imsg, params string[] args) | ||||
|         public async Task RoleColor(IUserMessage umsg, params string[] args) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (args.Count() != 2 && args.Count() != 4) | ||||
|             { | ||||
| @@ -194,9 +194,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.BanMembers)] | ||||
|         public async Task Ban(IMessage imsg, IGuildUser user) | ||||
|         public async Task Ban(IUserMessage umsg, IGuildUser user) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var msg = ""; | ||||
|  | ||||
| @@ -221,9 +221,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.BanMembers)] | ||||
|         public async Task Softban(IMessage imsg, IGuildUser user, [Remainder] string msg = null) | ||||
|         public async Task Softban(IUserMessage umsg, IGuildUser user, [Remainder] string msg = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!string.IsNullOrWhiteSpace(msg)) | ||||
|             { | ||||
| @@ -246,9 +246,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Kick(IMessage imsg, IGuildUser user, [Remainder] string msg = null) | ||||
|         public async Task Kick(IUserMessage umsg, IGuildUser user, [Remainder] string msg = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (user == null) | ||||
|             { | ||||
| @@ -275,9 +275,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.MuteMembers)] | ||||
|         public async Task Mute(IMessage imsg, params IGuildUser[] users) | ||||
|         public async Task Mute(IUserMessage umsg, params IGuildUser[] users) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!users.Any()) | ||||
|                 return; | ||||
| @@ -298,9 +298,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.MuteMembers)] | ||||
|         public async Task Unmute(IMessage imsg, params IGuildUser[] users) | ||||
|         public async Task Unmute(IUserMessage umsg, params IGuildUser[] users) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!users.Any()) | ||||
|                 return; | ||||
| @@ -321,9 +321,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.DeafenMembers)] | ||||
|         public async Task Deafen(IMessage imsg, params IGuildUser[] users) | ||||
|         public async Task Deafen(IUserMessage umsg, params IGuildUser[] users) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!users.Any()) | ||||
|                 return; | ||||
| @@ -344,9 +344,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.DeafenMembers)] | ||||
|         public async Task UnDeafen(IMessage imsg, params IGuildUser[] users) | ||||
|         public async Task UnDeafen(IUserMessage umsg, params IGuildUser[] users) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!users.Any()) | ||||
|                 return; | ||||
| @@ -367,18 +367,18 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageChannels)] | ||||
|         public async Task DelVoiChanl(IMessage imsg, [Remainder] IVoiceChannel voiceChannel) | ||||
|         public async Task DelVoiChanl(IUserMessage umsg, [Remainder] IVoiceChannel voiceChannel) | ||||
|         { | ||||
|             await voiceChannel.DeleteAsync().ConfigureAwait(false); | ||||
|             await imsg.Channel.SendMessageAsync($"Removed channel **{voiceChannel.Name}**.").ConfigureAwait(false); | ||||
|             await umsg.Channel.SendMessageAsync($"Removed channel **{voiceChannel.Name}**.").ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageChannels)] | ||||
|         public async Task CreatVoiChanl(IMessage imsg, [Remainder] string channelName) | ||||
|         public async Task CreatVoiChanl(IUserMessage umsg, [Remainder] string channelName) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             //todo actually print info about created channel | ||||
|             var ch = await channel.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false); | ||||
|             await channel.SendMessageAsync($"Created voice channel **{ch.Name}**, id `{ch.Id}`.").ConfigureAwait(false); | ||||
| @@ -387,7 +387,7 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageChannels)] | ||||
|         public async Task DelTxtChanl(IMessage imsg, [Remainder] ITextChannel channel) | ||||
|         public async Task DelTxtChanl(IUserMessage umsg, [Remainder] ITextChannel channel) | ||||
|         { | ||||
|             await channel.DeleteAsync().ConfigureAwait(false); | ||||
|             await channel.SendMessageAsync($"Removed text channel **{channel.Name}**, id `{channel.Id}`.").ConfigureAwait(false); | ||||
| @@ -396,9 +396,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageChannels)] | ||||
|         public async Task CreaTxtChanl(IMessage imsg, [Remainder] string channelName) | ||||
|         public async Task CreaTxtChanl(IUserMessage umsg, [Remainder] string channelName) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             //todo actually print info about created channel | ||||
|             var txtCh = await channel.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false); | ||||
|             await channel.SendMessageAsync($"Added text channel **{txtCh.Name}**, id `{txtCh.Id}`.").ConfigureAwait(false); | ||||
| @@ -407,9 +407,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageChannels)] | ||||
|         public async Task SetTopic(IMessage imsg, [Remainder] string topic = null) | ||||
|         public async Task SetTopic(IUserMessage umsg, [Remainder] string topic = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             topic = topic ?? ""; | ||||
|             await (channel as ITextChannel).ModifyAsync(c => c.Topic = topic); | ||||
|             await channel.SendMessageAsync(":ok: **New channel topic set.**").ConfigureAwait(false); | ||||
| @@ -418,9 +418,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.ManageChannels)] | ||||
|         public async Task SetChanlName(IMessage imsg, [Remainder] string name) | ||||
|         public async Task SetChanlName(IUserMessage umsg, [Remainder] string name) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false); | ||||
|             await channel.SendMessageAsync(":ok: **New channel name set.**").ConfigureAwait(false); | ||||
| @@ -430,24 +430,24 @@ namespace NadekoBot.Modules.Administration | ||||
|         //delets her own messages, no perm required | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Prune(IMessage imsg) | ||||
|         public async Task Prune(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var user = await channel.Guild.GetCurrentUserAsync(); | ||||
|              | ||||
|             var enumerable = (await imsg.Channel.GetMessagesAsync()).Where(x => x.Author.Id == user.Id); | ||||
|             await imsg.Channel.DeleteMessagesAsync(enumerable); | ||||
|             var enumerable = (await umsg.Channel.GetMessagesAsync()).Where(x => x.Author.Id == user.Id); | ||||
|             await umsg.Channel.DeleteMessagesAsync(enumerable); | ||||
|         } | ||||
|  | ||||
|         // prune x | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(ChannelPermission.ManageMessages)] | ||||
|         public async Task Prune(IMessage msg, int count) | ||||
|         public async Task Prune(IUserMessage msg, int count) | ||||
|         { | ||||
|             var channel = msg.Channel as ITextChannel; | ||||
|             await msg.DeleteAsync(); | ||||
|             await (msg as IUserMessage).DeleteAsync(); | ||||
|             while (count > 0) | ||||
|             { | ||||
|                 int limit = (count < 100) ? count : 100; | ||||
| @@ -462,7 +462,7 @@ namespace NadekoBot.Modules.Administration | ||||
|         //prune @user [x] | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Prune(IMessage msg, IGuildUser user, int count = 100) | ||||
|         public async Task Prune(IUserMessage msg, IGuildUser user, int count = 100) | ||||
|         { | ||||
|             var channel = msg.Channel as ITextChannel; | ||||
|             int limit = (count < 100) ? count : 100; | ||||
| @@ -472,9 +472,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Die(IMessage imsg) | ||||
|         //public async Task Die(IUserMessage umsg) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    await channel.SendMessageAsync("`Shutting down.`").ConfigureAwait(false); | ||||
|         //    await Task.Delay(2000).ConfigureAwait(false); | ||||
| @@ -484,18 +484,18 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Setname(IMessage imsg, [Remainder] string newName = null) | ||||
|         //public async Task Setname(IUserMessage umsg, [Remainder] string newName = null) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //} | ||||
|  | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task NewAvatar(IMessage imsg, [Remainder] string img = null) | ||||
|         //public async Task NewAvatar(IUserMessage umsg, [Remainder] string img = null) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    if (string.IsNullOrWhiteSpace(img)) | ||||
|         //        return; | ||||
| @@ -512,9 +512,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task SetGame(IMessage imsg, [Remainder] string game = null) | ||||
|         //public async Task SetGame(IUserMessage umsg, [Remainder] string game = null) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    game = game ?? ""; | ||||
|  | ||||
| @@ -524,9 +524,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Send(IMessage imsg, string where, [Remainder] string msg = null) | ||||
|         //public async Task Send(IUserMessage umsg, string where, [Remainder] string msg = null) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    if (string.IsNullOrWhiteSpace(msg)) | ||||
|         //        return; | ||||
| @@ -569,9 +569,9 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Announce(IMessage imsg, [Remainder] string message) | ||||
|         //public async Task Announce(IUserMessage umsg, [Remainder] string message) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    foreach (var ch in (await _client.GetGuildsAsync().ConfigureAwait(false)).Select(async g => await g.GetDefaultChannelAsync().ConfigureAwait(false))) | ||||
|         //    { | ||||
| @@ -584,21 +584,21 @@ namespace NadekoBot.Modules.Administration | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task SaveChat(IMessage imsg, int cnt) | ||||
|         //public async Task SaveChat(IUserMessage umsg, int cnt) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    ulong? lastmsgId = null; | ||||
|         //    var sb = new StringBuilder(); | ||||
|         //    var msgs = new List<IMessage>(cnt); | ||||
|         //    var msgs = new List<IUserMessage>(cnt); | ||||
|         //    while (cnt > 0) | ||||
|         //    { | ||||
|         //        var dlcnt = cnt < 100 ? cnt : 100; | ||||
|         //        IReadOnlyCollection<IMessage> dledMsgs; | ||||
|         //        IReadOnlyCollection<IUserMessage> dledMsgs; | ||||
|         //        if (lastmsgId == null) | ||||
|         //            dledMsgs = await imsg.Channel.GetMessagesAsync(cnt).ConfigureAwait(false); | ||||
|         //            dledMsgs = await umsg.Channel.GetMessagesAsync(cnt).ConfigureAwait(false); | ||||
|         //        else | ||||
|         //            dledMsgs = await imsg.Channel.GetMessagesAsync(lastmsgId.Value, Direction.Before, dlcnt); | ||||
|         //            dledMsgs = await umsg.Channel.GetMessagesAsync(lastmsgId.Value, Direction.Before, dlcnt); | ||||
|  | ||||
|         //        if (!dledMsgs.Any()) | ||||
|         //            break; | ||||
| @@ -608,7 +608,7 @@ namespace NadekoBot.Modules.Administration | ||||
|         //        cnt -= 100; | ||||
|         //    } | ||||
|         //    var title = $"Chatlog-{channel.Guild.Name}/#{channel.Name}-{DateTime.Now}.txt"; | ||||
|         //    await (imsg.Author as IGuildUser).SendFileAsync( | ||||
|         //    await (umsg.Author as IGuildUser).SendFileAsync( | ||||
|         //        await JsonConvert.SerializeObject(new { Messages = msgs.Select(s => s.ToString()) }, Formatting.Indented).ToStream().ConfigureAwait(false), | ||||
|         //        title, title).ConfigureAwait(false); | ||||
|         //} | ||||
| @@ -617,11 +617,11 @@ namespace NadekoBot.Modules.Administration | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         [RequirePermission(GuildPermission.MentionEveryone)] | ||||
|         public async Task MentionRole(IMessage imsg, params IRole[] roles) | ||||
|         public async Task MentionRole(IUserMessage umsg, params IRole[] roles) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             string send = $"--{imsg.Author.Mention} has invoked a mention on the following roles--"; | ||||
|             string send = $"--{umsg.Author.Mention} has invoked a mention on the following roles--"; | ||||
|             foreach (var role in roles) | ||||
|             {  | ||||
|                 send += $"\n`{role.Name}`\n"; | ||||
| @@ -641,9 +641,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Donators(IMessage imsg) | ||||
|         public async Task Donators(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             IEnumerable<Donator> donatorsOrdered; | ||||
|             using (var uow = DbHandler.UnitOfWork()) | ||||
|             { | ||||
| @@ -657,9 +657,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Donadd(IMessage imsg, IUser donator, int amount) | ||||
|         public async Task Donadd(IUserMessage umsg, IUser donator, int amount) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             Donator don; | ||||
|             using (var uow = DbHandler.UnitOfWork()) | ||||
|   | ||||
| @@ -41,9 +41,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageRoles)] | ||||
|             public async Task AutoAssignRole(IMessage imsg, [Remainder] IRole role = null) | ||||
|             public async Task AutoAssignRole(IUserMessage umsg, [Remainder] IRole role = null) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| //            { | ||||
| //                try | ||||
| //                { | ||||
| //                    if (imsg.Author.Id == NadekoBot.Client.CurrentUser.Id) return; | ||||
| //                    if (umsg.Author.Id == NadekoBot.Client.CurrentUser.Id) return; | ||||
| //                    foreach (var subscriber in Subscribers) | ||||
| //                    { | ||||
| //                        var set = subscriber.Value; | ||||
| @@ -26,7 +26,7 @@ | ||||
| //                            continue; | ||||
| //                        foreach (var chan in set.Except(new[] { e.Channel })) | ||||
| //                        { | ||||
| //                            await chan.SendMessageAsync(GetText(e.Server, e.Channel, imsg.Author, e.Message)).ConfigureAwait(false); | ||||
| //                            await chan.SendMessageAsync(GetText(e.Server, e.Channel, umsg.Author, e.Message)).ConfigureAwait(false); | ||||
| //                        } | ||||
| //                    } | ||||
| //                } | ||||
| @@ -46,9 +46,9 @@ | ||||
| //                        { | ||||
| //                            var msg = chan.Messages | ||||
| //                                .FirstOrDefault(m => | ||||
| //                                    m.RawText == GetText(e.Server, e.Channel, imsg.Author, e.Before)); | ||||
| //                                    m.RawText == GetText(e.Server, e.Channel, umsg.Author, e.Before)); | ||||
| //                            if (msg != default(Message)) | ||||
| //                                await msg.Edit(GetText(e.Server, e.Channel, imsg.Author, e.After)).ConfigureAwait(false); | ||||
| //                                await msg.Edit(GetText(e.Server, e.Channel, umsg.Author, e.After)).ConfigureAwait(false); | ||||
| //                        } | ||||
| //                    } | ||||
|  | ||||
| @@ -75,7 +75,7 @@ | ||||
| //                    if (Subscribers.TryAdd(token, set)) | ||||
| //                    { | ||||
| //                        set.Add(e.Channel); | ||||
| //                        await imsg.Author.SendMessageAsync("This is your CSC token:" + token.ToString()).ConfigureAwait(false); | ||||
| //                        await umsg.Author.SendMessageAsync("This is your CSC token:" + token.ToString()).ConfigureAwait(false); | ||||
| //                    } | ||||
| //                }); | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
| //                    var incs = DbHandler.Instance.FindAll<Incident>(i => i.ServerId == sid && i.Read == false); | ||||
| //                    DbHandler.Instance.Connection.UpdateAll(incs.Select(i => { i.Read = true; return i; })); | ||||
|  | ||||
| //                    await imsg.Author.SendMessageAsync(string.Join("\n----------------------", incs.Select(i => i.Text))); | ||||
| //                    await umsg.Author.SendMessageAsync(string.Join("\n----------------------", incs.Select(i => i.Text))); | ||||
| //                }); | ||||
|  | ||||
| //            cgb.CreateCommand(Module.Prefix + "listallincidents") | ||||
| @@ -41,7 +41,7 @@ | ||||
| //                    sw.WriteLine(data); | ||||
| //                    sw.Flush(); | ||||
| //                    sw.BaseStream.Position = 0; | ||||
| //                    await imsg.Author.SendFile("incidents.txt", sw.BaseStream); | ||||
| //                    await umsg.Author.SendFile("incidents.txt", sw.BaseStream); | ||||
| //                }); | ||||
| //        } | ||||
| //    } | ||||
|   | ||||
| @@ -36,17 +36,17 @@ | ||||
|  | ||||
| //            NadekoBot.Client.MessageReceived += async (s, e) => | ||||
| //            { | ||||
| //                if (e.Channel.IsPrivate || imsg.Author.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                if (e.Channel.IsPrivate || umsg.Author.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                    return; | ||||
| //                if (!SpecificConfigurations.Default.Of(e.Server.Id).SendPrivateMessageOnMention) return; | ||||
| //                try | ||||
| //                { | ||||
| //                    var usr = e.Message.MentionedUsers.FirstOrDefault(u => u != imsg.Author); | ||||
| //                    var usr = e.Message.MentionedUsers.FirstOrDefault(u => u != umsg.Author); | ||||
| //                    if (usr?.Status != UserStatus.Offline) | ||||
| //                        return; | ||||
| //                    await channel.SendMessageAsync($"User `{usr.Name}` is offline. PM sent.").ConfigureAwait(false); | ||||
| //                    await usr.SendMessageAsync( | ||||
| //                        $"User `{imsg.Author.Username}` mentioned you on " + | ||||
| //                        $"User `{umsg.Author.Username}` mentioned you on " + | ||||
| //                        $"`{e.Server.Name}` server while you were offline.\n" + | ||||
| //                        $"`Message:` {e.Message.Text}").ConfigureAwait(false); | ||||
| //                } | ||||
| @@ -148,7 +148,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`♻`User was unbanned:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`♻`User was unbanned:` **{umsg.Author.Username}** ({umsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -163,7 +163,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`✅`User joined:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`✅`User joined:` **{umsg.Author.Username}** ({umsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -178,7 +178,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`❗`User left:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`❗`User left:` **{umsg.Author.Username}** ({umsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -193,7 +193,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessageAsync($"❗`{prettyCurrentTime}`❌`User banned:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"❗`{prettyCurrentTime}`❌`User banned:` **{umsg.Author.Username}** ({umsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -202,7 +202,7 @@ | ||||
| //        { | ||||
| //            try | ||||
| //            { | ||||
| //                if (e.Server == null || e.Channel.IsPrivate || imsg.Author.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                if (e.Server == null || e.Channel.IsPrivate || umsg.Author.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                    return; | ||||
| //                var config = SpecificConfigurations.Default.Of(e.Server.Id); | ||||
| //                var chId = config.LogServerChannel; | ||||
| @@ -215,13 +215,13 @@ | ||||
| //                { | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); | ||||
| //👤`{umsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); | ||||
| //                } | ||||
| //                else | ||||
| //                { | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **File Uploaded** `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); | ||||
| //👤`{umsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); | ||||
| //                } | ||||
|  | ||||
| //            } | ||||
| @@ -231,7 +231,7 @@ | ||||
| //        { | ||||
| //            try | ||||
| //            { | ||||
| //                if (e.Server == null || e.Channel.IsPrivate || imsg.Author?.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                if (e.Server == null || e.Channel.IsPrivate || umsg.Author?.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                    return; | ||||
| //                var config = SpecificConfigurations.Default.Of(e.Server.Id); | ||||
| //                var chId = config.LogServerChannel; | ||||
| @@ -244,13 +244,13 @@ | ||||
| //                { | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **Message** 🚮 `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); | ||||
| //👤`{umsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); | ||||
| //                } | ||||
| //                else | ||||
| //                { | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **File Deleted** `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); | ||||
| //👤`{umsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); | ||||
| //                } | ||||
| //            } | ||||
| //            catch { } | ||||
| @@ -259,7 +259,7 @@ | ||||
| //        { | ||||
| //            try | ||||
| //            { | ||||
| //                if (e.Server == null || e.Channel.IsPrivate || imsg.Author?.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                if (e.Server == null || e.Channel.IsPrivate || umsg.Author?.Id == NadekoBot.Client.CurrentUser.Id) | ||||
| //                    return; | ||||
| //                var config = SpecificConfigurations.Default.Of(e.Server.Id); | ||||
| //                var chId = config.LogServerChannel; | ||||
| @@ -270,7 +270,7 @@ | ||||
| //                    return; | ||||
| //                await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` | ||||
| //👤`{umsg.Author?.ToString() ?? ("NULL")}` | ||||
| //        `Old:` {e.Before.Text.Unmention()} | ||||
| //        `New:` {e.After.Text.Unmention()}").ConfigureAwait(false); | ||||
| //            } | ||||
| @@ -466,19 +466,19 @@ | ||||
| //                          return; | ||||
| //                      } | ||||
|  | ||||
| //                      if (imsg.Author.VoiceChannel == null) | ||||
| //                      if (umsg.Author.VoiceChannel == null) | ||||
| //                      { | ||||
| //                          await channel.SendMessageAsync("💢 You are not in a voice channel right now. If you are, please rejoin it.").ConfigureAwait(false); | ||||
| //                          return; | ||||
| //                      } | ||||
| //                      ulong throwaway; | ||||
| //                      if (!config.VoiceChannelLog.TryRemove(imsg.Author.VoiceChannel.Id, out throwaway)) | ||||
| //                      if (!config.VoiceChannelLog.TryRemove(umsg.Author.VoiceChannel.Id, out throwaway)) | ||||
| //                      { | ||||
| //                          config.VoiceChannelLog.TryAdd(imsg.Author.VoiceChannel.Id, e.Channel.Id); | ||||
| //                          await channel.SendMessageAsync($"`Logging user updates for` {imsg.Author.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); | ||||
| //                          config.VoiceChannelLog.TryAdd(umsg.Author.VoiceChannel.Id, e.Channel.Id); | ||||
| //                          await channel.SendMessageAsync($"`Logging user updates for` {umsg.Author.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); | ||||
| //                      } | ||||
| //                      else | ||||
| //                          await channel.SendMessageAsync($"`Stopped logging user updates for` {imsg.Author.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); | ||||
| //                          await channel.SendMessageAsync($"`Stopped logging user updates for` {umsg.Author.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); | ||||
| //                  }); | ||||
| //        } | ||||
| //    } | ||||
|   | ||||
| @@ -88,9 +88,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task RotatePlaying(IMessage imsg) | ||||
|             public async Task RotatePlaying(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 bool status; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -108,9 +108,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task AddPlaying(IMessage imsg, [Remainder] string status) | ||||
|             public async Task AddPlaying(IUserMessage umsg, [Remainder] string status) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
|                 { | ||||
| @@ -124,9 +124,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task ListPlaying(IMessage imsg) | ||||
|             public async Task ListPlaying(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 List<PlayingStatus> statuses; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -139,16 +139,16 @@ namespace NadekoBot.Modules.Administration | ||||
|                 else | ||||
|                 { | ||||
|                     var i = 1; | ||||
|                     await channel.SendMessageAsync($"{imsg.Author.Mention} `Here is a list of rotating statuses:`\n\n\t" + string.Join("\n\t", statuses.Select(rs => $"`{i++}.` {rs.Status}"))); | ||||
|                     await channel.SendMessageAsync($"{umsg.Author.Mention} `Here is a list of rotating statuses:`\n\n\t" + string.Join("\n\t", statuses.Select(rs => $"`{i++}.` {rs.Status}"))); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task RemovePlaying(IMessage imsg, int index) | ||||
|             public async Task RemovePlaying(IUserMessage umsg, int index) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 index -= 1; | ||||
|  | ||||
|                 string msg = ""; | ||||
|   | ||||
| @@ -25,36 +25,37 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|                 this._client = NadekoBot.Client; | ||||
|  | ||||
|                _client.MessageReceived += async (imsg) => | ||||
|                _client.MessageReceived += async (umsg) => | ||||
|                 { | ||||
|                     var channel = imsg.Channel as ITextChannel; | ||||
|                     var usrMsg = umsg as IUserMessage; | ||||
|                     var channel = usrMsg.Channel as ITextChannel; | ||||
|  | ||||
|                     if (channel == null || await imsg.IsAuthor()) | ||||
|                     if (channel == null || await usrMsg.IsAuthor()) | ||||
|                         return; | ||||
|                     ConcurrentDictionary<ulong, DateTime> userTimePair; | ||||
|                     if (!RatelimitingChannels.TryGetValue(channel.Id, out userTimePair)) return; | ||||
|                     DateTime lastMessageTime; | ||||
|                     if (userTimePair.TryGetValue(imsg.Author.Id, out lastMessageTime)) | ||||
|                     if (userTimePair.TryGetValue(usrMsg.Author.Id, out lastMessageTime)) | ||||
|                     { | ||||
|                         if (DateTime.Now - lastMessageTime < ratelimitTime) | ||||
|                         { | ||||
|                             try | ||||
|                             { | ||||
|                                 await imsg.DeleteAsync().ConfigureAwait(false); | ||||
|                                 await usrMsg.DeleteAsync().ConfigureAwait(false); | ||||
|                             } | ||||
|                             catch { } | ||||
|                             return; | ||||
|                         } | ||||
|                     } | ||||
|                     userTimePair.AddOrUpdate(imsg.Author.Id, id => DateTime.Now, (id, dt) => DateTime.Now); | ||||
|                     userTimePair.AddOrUpdate(usrMsg.Author.Id, id => DateTime.Now, (id, dt) => DateTime.Now); | ||||
|                 }; | ||||
|             } | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Slowmode(IMessage imsg) | ||||
|             public async Task Slowmode(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 ConcurrentDictionary<ulong, DateTime> throwaway; | ||||
|                 if (RatelimitingChannels.TryRemove(channel.Id, out throwaway)) | ||||
|   | ||||
| @@ -22,9 +22,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageRoles)] | ||||
|             public async Task Asar(IMessage imsg, [Remainder] IRole role) | ||||
|             public async Task Asar(IUserMessage umsg, [Remainder] IRole role) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 IEnumerable<SelfAssignedRole> roles; | ||||
|  | ||||
| @@ -52,9 +52,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageRoles)] | ||||
|             public async Task Rsar(IMessage imsg, [Remainder] IRole role) | ||||
|             public async Task Rsar(IUserMessage umsg, [Remainder] IRole role) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 bool success; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -72,9 +72,9 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Lsar(IMessage imsg) | ||||
|             public async Task Lsar(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 var toRemove = new HashSet<SelfAssignedRole>(); | ||||
|                 var removeMsg = new StringBuilder(); | ||||
| @@ -108,9 +108,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageRoles)] | ||||
|             public async Task Tesar(IMessage imsg) | ||||
|             public async Task Tesar(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 bool areExclusive; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -126,10 +126,11 @@ namespace NadekoBot.Modules.Administration | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Iam(IMessage imsg, [Remainder] IRole role) | ||||
|             public async Task Iam(IUserMessage umsg, [Remainder] IRole role) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var guildUser = (IGuildUser)imsg.Author; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 var guildUser = (IGuildUser)umsg.Author; | ||||
|                 var usrMsg = (IUserMessage)umsg; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 IEnumerable<SelfAssignedRole> roles; | ||||
| @@ -176,17 +177,17 @@ namespace NadekoBot.Modules.Administration | ||||
|                     { | ||||
|                         await Task.Delay(3000).ConfigureAwait(false); | ||||
|                         try { await msg.DeleteAsync().ConfigureAwait(false); } catch { } // if 502 or something, i don't want bot crashing | ||||
|                         try { await imsg.DeleteAsync().ConfigureAwait(false); } catch { } | ||||
|                         try { await usrMsg.DeleteAsync().ConfigureAwait(false); } catch { } | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Iamnot(IMessage imsg, [Remainder] IRole role) | ||||
|             public async Task Iamnot(IUserMessage umsg, [Remainder] IRole role) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var guildUser = (IGuildUser)imsg.Author; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 var guildUser = (IGuildUser)umsg.Author; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 IEnumerable<SelfAssignedRole> roles; | ||||
| @@ -223,7 +224,7 @@ namespace NadekoBot.Modules.Administration | ||||
|                     { | ||||
|                         await Task.Delay(3000).ConfigureAwait(false); | ||||
|                         try { await msg.DeleteAsync().ConfigureAwait(false); } catch { } // if 502 or something, i don't want bot crashing | ||||
|                         try { await imsg.DeleteAsync().ConfigureAwait(false); } catch { } | ||||
|                         try { await umsg.DeleteAsync().ConfigureAwait(false); } catch { } | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -22,9 +22,9 @@ | ||||
|  | ||||
| //            [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
| //            [RequireContext(ContextType.Guild)] | ||||
| //            public async Task Leave(IMessage imsg, [Remainder] string guildStr) | ||||
| //            public async Task Leave(IUserMessage umsg, [Remainder] string guildStr) | ||||
| //            { | ||||
| //                var channel = (ITextChannel)imsg.Channel; | ||||
| //                var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
| //                guildStr = guildStr.ToUpperInvariant(); | ||||
| //                var server = _client.GetGuilds().FirstOrDefault(g => g.Id.ToString() == guildStr) ?? _client.GetGuilds().FirstOrDefault(g => g.Name.ToUpperInvariant() == guildStr); | ||||
|   | ||||
| @@ -109,9 +109,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task GreetDel(IMessage imsg) | ||||
|             public async Task GreetDel(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -131,9 +131,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task Greet(IMessage imsg) | ||||
|             public async Task Greet(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -154,9 +154,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task GreetMsg(IMessage imsg, [Remainder] string text) | ||||
|             public async Task GreetMsg(IUserMessage umsg, [Remainder] string text) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -183,9 +183,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task GreetDm(IMessage imsg) | ||||
|             public async Task GreetDm(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -205,9 +205,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task GreetDmMsg(IMessage imsg, [Remainder] string text) | ||||
|             public async Task GreetDmMsg(IUserMessage umsg, [Remainder] string text) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -234,9 +234,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task Bye(IMessage imsg) | ||||
|             public async Task Bye(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -257,9 +257,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task ByeMsg(IMessage imsg, [Remainder] string text) | ||||
|             public async Task ByeMsg(IUserMessage umsg, [Remainder] string text) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
| @@ -286,9 +286,9 @@ namespace NadekoBot.Modules.Administration | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [RequirePermission(GuildPermission.ManageGuild)] | ||||
|             public async Task ByeDel(IMessage imsg) | ||||
|             public async Task ByeDel(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 GuildConfig conf; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
|   | ||||
| @@ -57,11 +57,11 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task CreateWar(IMessage imsg, int size, [Remainder] string enemyClan = null) | ||||
|         public async Task CreateWar(IUserMessage umsg, int size, [Remainder] string enemyClan = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!(imsg.Author as IGuildUser).GuildPermissions.ManageChannels) | ||||
|             if (!(umsg.Author as IGuildUser).GuildPermissions.ManageChannels) | ||||
|                 return; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(enemyClan)) | ||||
| @@ -81,7 +81,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             } | ||||
|  | ||||
|  | ||||
|             var cw = await CreateWar(enemyClan, size, channel.Guild.Id, imsg.Channel.Id); | ||||
|             var cw = await CreateWar(enemyClan, size, channel.Guild.Id, umsg.Channel.Id); | ||||
|             //cw.Start(); | ||||
|  | ||||
|             wars.Add(cw); | ||||
| @@ -90,14 +90,14 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task StartWar(IMessage imsg, [Remainder] string number = null) | ||||
|         public async Task StartWar(IUserMessage umsg, [Remainder] string number = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             int num = 0; | ||||
|             int.TryParse(number, out num); | ||||
|  | ||||
|             var warsInfo = GetWarInfo(imsg, num); | ||||
|             var warsInfo = GetWarInfo(umsg, num); | ||||
|             if (warsInfo == null) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); | ||||
| @@ -118,9 +118,9 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ListWar(IMessage imsg, [Remainder] string number = null) | ||||
|         public async Task ListWar(IUserMessage umsg, [Remainder] string number = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             // if number is null, print all wars in a short way | ||||
|             if (string.IsNullOrWhiteSpace(number)) | ||||
| @@ -150,7 +150,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             var num = 0; | ||||
|             int.TryParse(number, out num); | ||||
|             //if number is not null, print the war needed | ||||
|             var warsInfo = GetWarInfo(imsg, num); | ||||
|             var warsInfo = GetWarInfo(umsg, num); | ||||
|             if (warsInfo == null) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); | ||||
| @@ -161,10 +161,10 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Claim(IMessage imsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         public async Task Claim(IUserMessage umsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var warsInfo = GetWarInfo(imsg, number); | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var warsInfo = GetWarInfo(umsg, number); | ||||
|             if (warsInfo == null || warsInfo.Item1.Count == 0) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); | ||||
| @@ -172,7 +172,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             } | ||||
|             var usr = | ||||
|                 string.IsNullOrWhiteSpace(other_name) ? | ||||
|                 imsg.Author.Username : | ||||
|                 umsg.Author.Username : | ||||
|                 other_name; | ||||
|             try | ||||
|             { | ||||
| @@ -189,35 +189,35 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ClaimFinish1(IMessage imsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         public async Task ClaimFinish1(IUserMessage umsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             await FinishClaim(imsg, number, baseNumber, other_name, 1); | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             await FinishClaim(umsg, number, baseNumber, other_name, 1); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ClaimFinish2(IMessage imsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         public async Task ClaimFinish2(IUserMessage umsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             await FinishClaim(imsg, number, baseNumber, other_name, 2); | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             await FinishClaim(umsg, number, baseNumber, other_name, 2); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ClaimFinish(IMessage imsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         public async Task ClaimFinish(IUserMessage umsg, int number, int baseNumber, [Remainder] string other_name = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             await FinishClaim(imsg, number, baseNumber, other_name); | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             await FinishClaim(umsg, number, baseNumber, other_name); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task EndWar(IMessage imsg, int number) | ||||
|         public async Task EndWar(IUserMessage umsg, int number) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var warsInfo = GetWarInfo(imsg,number); | ||||
|             var warsInfo = GetWarInfo(umsg,number); | ||||
|             if (warsInfo == null) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢🔰 That war does not exist.").ConfigureAwait(false); | ||||
| @@ -234,11 +234,11 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Unclaim(IMessage imsg, int number, [Remainder] string otherName = null) | ||||
|         public async Task Unclaim(IUserMessage umsg, int number, [Remainder] string otherName = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var warsInfo = GetWarInfo(imsg, number); | ||||
|             var warsInfo = GetWarInfo(umsg, number); | ||||
|             if (warsInfo == null || warsInfo.Item1.Count == 0) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); | ||||
| @@ -246,7 +246,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             } | ||||
|             var usr = | ||||
|                 string.IsNullOrWhiteSpace(otherName) ? | ||||
|                 imsg.Author.Username : | ||||
|                 umsg.Author.Username : | ||||
|                 otherName; | ||||
|             try | ||||
|             { | ||||
| @@ -261,10 +261,10 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private async Task FinishClaim(IMessage imsg, int number, int baseNumber, [Remainder] string other_name, int stars = 3) | ||||
|         private async Task FinishClaim(IUserMessage umsg, int number, int baseNumber, [Remainder] string other_name, int stars = 3) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var warInfo = GetWarInfo(imsg, number); | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var warInfo = GetWarInfo(umsg, number); | ||||
|             if (warInfo == null || warInfo.Item1.Count == 0) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); | ||||
| @@ -272,7 +272,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             } | ||||
|             var usr = | ||||
|                 string.IsNullOrWhiteSpace(other_name) ? | ||||
|                 imsg.Author.Username : | ||||
|                 umsg.Author.Username : | ||||
|                 other_name; | ||||
|  | ||||
|             var war = warInfo.Item1[warInfo.Item2]; | ||||
| @@ -280,7 +280,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             { | ||||
|                 var baseNum = war.FinishClaim(usr, stars); | ||||
|                 SaveWar(war); | ||||
|                 await channel.SendMessageAsync($"❗🔰{imsg.Author.Mention} **DESTROYED** a base #{baseNum + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false); | ||||
|                 await channel.SendMessageAsync($"❗🔰{umsg.Author.Mention} **DESTROYED** a base #{baseNum + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
| @@ -288,9 +288,9 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private static Tuple<List<ClashWar>, int> GetWarInfo(IMessage imsg, int num) | ||||
|         private static Tuple<List<ClashWar>, int> GetWarInfo(IUserMessage umsg, int num) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             //check if there are any wars | ||||
|             List<ClashWar> wars = null; | ||||
|             ClashWars.TryGetValue(channel.Guild.Id, out wars); | ||||
|   | ||||
| @@ -22,9 +22,9 @@ namespace NadekoBot.Modules.Gambling | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Race(IMessage imsg) | ||||
|             public async Task Race(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 var ar = new AnimalRace(channel.Guild.Id, channel); | ||||
|  | ||||
| @@ -34,24 +34,24 @@ namespace NadekoBot.Modules.Gambling | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task JoinRace(IMessage imsg, int amount = 0) | ||||
|             public async Task JoinRace(IUserMessage umsg, int amount = 0) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 if (amount < 0) | ||||
|                     amount = 0; | ||||
|  | ||||
|                 //todo DB | ||||
|                 //var userFlowers = Gambling.GetUserFlowers(imsg.Author.Id); | ||||
|                 //var userFlowers = Gambling.GetUserFlowers(umsg.Author.Id); | ||||
|  | ||||
|                 //if (userFlowers < amount) | ||||
|                 //{ | ||||
|                 //    await channel.SendMessageAsync($"{imsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|                 //    await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|                 //    return; | ||||
|                 //} | ||||
|  | ||||
|                 //if (amount > 0) | ||||
|                 //    await FlowersHandler.RemoveFlowers(imsg.Author, "BetRace", (int)amount, true).ConfigureAwait(false); | ||||
|                 //    await FlowersHandler.RemoveFlowers(umsg.Author, "BetRace", (int)amount, true).ConfigureAwait(false); | ||||
|  | ||||
|                 AnimalRace ar; | ||||
|                 if (!AnimalRaces.TryGetValue(channel.Guild.Id, out ar)) | ||||
| @@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Gambling | ||||
|                     await channel.SendMessageAsync("No race exists on this server"); | ||||
|                     return; | ||||
|                 } | ||||
|                 await ar.JoinRace(imsg.Author as IGuildUser, amount); | ||||
|                 await ar.JoinRace(umsg.Author as IGuildUser, amount); | ||||
|             } | ||||
|  | ||||
|             public class AnimalRace | ||||
| @@ -139,7 +139,7 @@ namespace NadekoBot.Modules.Gambling | ||||
|                 { | ||||
|                     var rng = new Random(); | ||||
|                     Participant winner = null; | ||||
|                     IMessage msg = null; | ||||
|                     IUserMessage msg = null; | ||||
|                     int place = 1; | ||||
|                     try | ||||
|                     { | ||||
| @@ -204,7 +204,10 @@ namespace NadekoBot.Modules.Gambling | ||||
|  | ||||
|                 private async Task Client_MessageReceived(IMessage imsg) | ||||
|                 { | ||||
|                     if (await imsg.IsAuthor() || !(imsg.Channel is ITextChannel) || imsg.Channel != raceChannel) | ||||
|                     var msg = imsg as IUserMessage; | ||||
|                     if (msg == null) | ||||
|                         return; | ||||
|                     if (await msg.IsAuthor() || !(imsg.Channel is ITextChannel) || imsg.Channel != raceChannel) | ||||
|                         return; | ||||
|                     messagesSinceGameStarted++; | ||||
|                 } | ||||
|   | ||||
| @@ -16,16 +16,16 @@ namespace NadekoBot.Modules.Gambling | ||||
|         ////todo drawing | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public Task Roll(IMessage imsg, [Remainder] string arg = null) => | ||||
|         //    InternalRoll(imsg, arg, true); | ||||
|         //public Task Roll(IUserMessage umsg, [Remainder] string arg = null) => | ||||
|         //    InternalRoll(umsg, arg, true); | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public Task Rolluo(IMessage imsg, [Remainder] string arg = null) => | ||||
|         //    InternalRoll(imsg, arg, false); | ||||
|         //public Task Rolluo(IUserMessage umsg, [Remainder] string arg = null) => | ||||
|         //    InternalRoll(umsg, arg, false); | ||||
|  | ||||
|         //private async Task InternalRoll(IMessage imsg, string arg, bool ordered) { | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //private async Task InternalRoll(IUserMessage umsg, string arg, bool ordered) { | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|         //    var r = new Random(); | ||||
|         //    if (string.IsNullOrWhiteSpace(arg)) | ||||
|         //    { | ||||
| @@ -107,9 +107,9 @@ namespace NadekoBot.Modules.Gambling | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task NRoll(IMessage imsg, [Remainder] string range) | ||||
|         public async Task NRoll(IUserMessage umsg, [Remainder] string range) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|             try | ||||
| @@ -130,7 +130,7 @@ namespace NadekoBot.Modules.Gambling | ||||
|                     rolled = new Random().Next(0, int.Parse(range) + 1); | ||||
|                 } | ||||
|  | ||||
|                 await channel.SendMessageAsync($"{imsg.Author.Mention} rolled **{rolled}**.").ConfigureAwait(false); | ||||
|                 await channel.SendMessageAsync($"{umsg.Author.Mention} rolled **{rolled}**.").ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|   | ||||
| @@ -80,7 +80,7 @@ | ||||
| //                await e.Channel.SendFile(images.Count + " cards.jpg", bitmap.ToStream()).ConfigureAwait(false); | ||||
| //                if (cardObjects.Count == 5) | ||||
| //                { | ||||
| //                    await channel.SendMessageAsync($"{imsg.Author.Mention} `{Cards.GetHandValue(cardObjects)}`").ConfigureAwait(false); | ||||
| //                    await channel.SendMessageAsync($"{umsg.Author.Mention} `{Cards.GetHandValue(cardObjects)}`").ConfigureAwait(false); | ||||
| //                } | ||||
| //            } | ||||
| //            catch (Exception ex) | ||||
|   | ||||
| @@ -44,15 +44,15 @@ | ||||
| //            if (!int.TryParse(amountstr, out amount) || amount < 1) | ||||
| //                return; | ||||
|  | ||||
| //            var userFlowers = Gambling.GetUserFlowers(imsg.Author.Id); | ||||
| //            var userFlowers = Gambling.GetUserFlowers(umsg.Author.Id); | ||||
|  | ||||
| //            if (userFlowers < amount) | ||||
| //            { | ||||
| //                await channel.SendMessageAsync($"{imsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
| //                await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
| //                return; | ||||
| //            } | ||||
|  | ||||
| //            await FlowersHandler.RemoveFlowers(imsg.Author, "Betflip Gamble", (int)amount, true).ConfigureAwait(false); | ||||
| //            await FlowersHandler.RemoveFlowers(umsg.Author, "Betflip Gamble", (int)amount, true).ConfigureAwait(false); | ||||
| //            //heads = true | ||||
| //            //tails = false | ||||
|  | ||||
| @@ -69,12 +69,12 @@ | ||||
| //            string str; | ||||
| //            if (guess == result) | ||||
| //            { | ||||
| //                str = $"{imsg.Author.Mention}`You guessed it!` You won {amount * 2}{NadekoBot.Config.CurrencySign}"; | ||||
| //                await FlowersHandler.AddFlowersAsync(imsg.Author, "Betflip Gamble", amount * 2, true).ConfigureAwait(false); | ||||
| //                str = $"{umsg.Author.Mention}`You guessed it!` You won {amount * 2}{NadekoBot.Config.CurrencySign}"; | ||||
| //                await FlowersHandler.AddFlowersAsync(umsg.Author, "Betflip Gamble", amount * 2, true).ConfigureAwait(false); | ||||
|  | ||||
| //            } | ||||
| //            else | ||||
| //                str = $"{imsg.Author.Mention}`More luck next time.`"; | ||||
| //                str = $"{umsg.Author.Mention}`More luck next time.`"; | ||||
|  | ||||
| //            await channel.SendMessageAsync(str).ConfigureAwait(false); | ||||
| //        }; | ||||
|   | ||||
| @@ -35,9 +35,9 @@ namespace NadekoBot.Modules.Gambling | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Raffle(IMessage imsg, [Remainder] IRole role = null) | ||||
|         public async Task Raffle(IUserMessage umsg, [Remainder] IRole role = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             role = role ?? channel.Guild.EveryoneRole; | ||||
|  | ||||
| @@ -51,11 +51,11 @@ namespace NadekoBot.Modules.Gambling | ||||
|         ////todo DB | ||||
|         //[LocalizedCommand("$$$"), LocalizedDescription("$$$"), LocalizedSummary("$$$")] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Cash(IMessage imsg, [Remainder] string arg) | ||||
|         //public async Task Cash(IUserMessage umsg, [Remainder] string arg) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    var usr = e.Message.MentionedUsers.FirstOrDefault() ?? imsg.Author; | ||||
|         //    var usr = e.Message.MentionedUsers.FirstOrDefault() ?? umsg.Author; | ||||
|         //    var pts = GetUserFlowers(usr.Id); | ||||
|         //    var str = $"{usr.Name} has {pts} {NadekoBot.Config.CurrencySign}"; | ||||
|         //    await channel.SendMessageAsync(str).ConfigureAwait(false); | ||||
| @@ -64,23 +64,23 @@ namespace NadekoBot.Modules.Gambling | ||||
|         ////todo DB | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Give(IMessage imsg, long amount, [Remainder] IUser receiver) | ||||
|         //public async Task Give(IUserMessage umsg, long amount, [Remainder] IUser receiver) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|         //    if (amount <= 0) | ||||
|         //        return; | ||||
|         //    var userFlowers = GetUserFlowers(imsg.Author.Id); | ||||
|         //    var userFlowers = GetUserFlowers(umsg.Author.Id); | ||||
|  | ||||
|         //    if (userFlowers < amount) | ||||
|         //    { | ||||
|         //        await channel.SendMessageAsync($"{imsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|         //        await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|         //        return; | ||||
|         //    } | ||||
|  | ||||
|         //    await FlowersHandler.RemoveFlowers(imsg.Author, "Gift", (int)amount, true).ConfigureAwait(false); | ||||
|         //    await FlowersHandler.RemoveFlowers(umsg.Author, "Gift", (int)amount, true).ConfigureAwait(false); | ||||
|         //    await FlowersHandler.AddFlowersAsync(receiver, "Gift", (int)amount).ConfigureAwait(false); | ||||
|  | ||||
|         //    await channel.SendMessageAsync($"{imsg.Author.Mention} successfully sent {amount} {NadekoBot.Config.CurrencyName}s to {receiver.Mention}!").ConfigureAwait(false); | ||||
|         //    await channel.SendMessageAsync($"{umsg.Author.Mention} successfully sent {amount} {NadekoBot.Config.CurrencyName}s to {receiver.Mention}!").ConfigureAwait(false); | ||||
|  | ||||
|         //} | ||||
|  | ||||
| @@ -88,64 +88,64 @@ namespace NadekoBot.Modules.Gambling | ||||
|         ////todo owner only | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public Task Award(IMessage imsg, long amount, [Remainder] IGuildUser usr) => | ||||
|         //    Award(imsg, amount, usr.Id); | ||||
|         //public Task Award(IUserMessage umsg, long amount, [Remainder] IGuildUser usr) => | ||||
|         //    Award(umsg, amount, usr.Id); | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Award(IMessage imsg, long amount, [Remainder] ulong usrId) | ||||
|         //public async Task Award(IUserMessage umsg, long amount, [Remainder] ulong usrId) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    if (amount <= 0) | ||||
|         //        return; | ||||
|  | ||||
|         //    await FlowersHandler.AddFlowersAsync(usrId, $"Awarded by bot owner. ({imsg.Author.Username}/{imsg.Author.Id})", (int)amount).ConfigureAwait(false); | ||||
|         //    await FlowersHandler.AddFlowersAsync(usrId, $"Awarded by bot owner. ({umsg.Author.Username}/{umsg.Author.Id})", (int)amount).ConfigureAwait(false); | ||||
|  | ||||
|         //    await channel.SendMessageAsync($"{imsg.Author.Mention} successfully awarded {amount} {NadekoBot.Config.CurrencyName}s to <@{usrId}>!").ConfigureAwait(false); | ||||
|         //    await channel.SendMessageAsync($"{umsg.Author.Mention} successfully awarded {amount} {NadekoBot.Config.CurrencyName}s to <@{usrId}>!").ConfigureAwait(false); | ||||
|         //} | ||||
|  | ||||
|         ////todo owner only | ||||
|         ////todo DB | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public Task Take(IMessage imsg, long amount, [Remainder] IGuildUser user) => | ||||
|         //    Take(imsg, amount, user.Id); | ||||
|         //public Task Take(IUserMessage umsg, long amount, [Remainder] IGuildUser user) => | ||||
|         //    Take(umsg, amount, user.Id); | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Take(IMessage imsg, long amount, [Remainder] ulong usrId) | ||||
|         //public async Task Take(IUserMessage umsg, long amount, [Remainder] ulong usrId) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|         //    if (amount <= 0) | ||||
|         //        return; | ||||
|  | ||||
|         //    await FlowersHandler.RemoveFlowers(usrId, $"Taken by bot owner.({imsg.Author.Username}/{imsg.Author.Id})", (int)amount).ConfigureAwait(false); | ||||
|         //    await FlowersHandler.RemoveFlowers(usrId, $"Taken by bot owner.({umsg.Author.Username}/{umsg.Author.Id})", (int)amount).ConfigureAwait(false); | ||||
|  | ||||
|         //    await channel.SendMessageAsync($"{imsg.Author.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from <@{usrId}>!").ConfigureAwait(false); | ||||
|         //    await channel.SendMessageAsync($"{umsg.Author.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from <@{usrId}>!").ConfigureAwait(false); | ||||
|         //} | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task BetRoll(IMessage imsg, int amount) | ||||
|         //public async Task BetRoll(IUserMessage umsg, int amount) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    if (amount < 1) | ||||
|         //        return; | ||||
|  | ||||
|         //    var userFlowers = GetUserFlowers(imsg.Author.Id); | ||||
|         //    var userFlowers = GetUserFlowers(umsg.Author.Id); | ||||
|  | ||||
|         //    if (userFlowers < amount) | ||||
|         //    { | ||||
|         //        await channel.SendMessageAsync($"{imsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|         //        await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|         //        return; | ||||
|         //    } | ||||
|  | ||||
|         //    await FlowersHandler.RemoveFlowers(imsg.Author, "Betroll Gamble", (int)amount, true).ConfigureAwait(false); | ||||
|         //    await FlowersHandler.RemoveFlowers(umsg.Author, "Betroll Gamble", (int)amount, true).ConfigureAwait(false); | ||||
|  | ||||
|         //    var rng = new Random().Next(0, 101); | ||||
|         //    var str = $"{imsg.Author.Mention} `You rolled {rng}.` "; | ||||
|         //    var str = $"{umsg.Author.Mention} `You rolled {rng}.` "; | ||||
|         //    if (rng < 67) | ||||
|         //    { | ||||
|         //        str += "Better luck next time."; | ||||
| @@ -153,17 +153,17 @@ namespace NadekoBot.Modules.Gambling | ||||
|         //    else if (rng < 90) | ||||
|         //    { | ||||
|         //        str += $"Congratulations! You won {amount * 2}{NadekoBot.Config.CurrencySign} for rolling above 66"; | ||||
|         //        await FlowersHandler.AddFlowersAsync(imsg.Author, "Betroll Gamble", amount * 2, true).ConfigureAwait(false); | ||||
|         //        await FlowersHandler.AddFlowersAsync(umsg.Author, "Betroll Gamble", amount * 2, true).ConfigureAwait(false); | ||||
|         //    } | ||||
|         //    else if (rng < 100) | ||||
|         //    { | ||||
|         //        str += $"Congratulations! You won {amount * 3}{NadekoBot.Config.CurrencySign} for rolling above 90."; | ||||
|         //        await FlowersHandler.AddFlowersAsync(imsg.Author, "Betroll Gamble", amount * 3, true).ConfigureAwait(false); | ||||
|         //        await FlowersHandler.AddFlowersAsync(umsg.Author, "Betroll Gamble", amount * 3, true).ConfigureAwait(false); | ||||
|         //    } | ||||
|         //    else | ||||
|         //    { | ||||
|         //        str += $"👑 Congratulations! You won {amount * 10}{NadekoBot.Config.CurrencySign} for rolling **100**. 👑"; | ||||
|         //        await FlowersHandler.AddFlowersAsync(imsg.Author, "Betroll Gamble", amount * 10, true).ConfigureAwait(false); | ||||
|         //        await FlowersHandler.AddFlowersAsync(umsg.Author, "Betroll Gamble", amount * 10, true).ConfigureAwait(false); | ||||
|         //    } | ||||
|  | ||||
|         //    await channel.SendMessageAsync(str).ConfigureAwait(false); | ||||
| @@ -172,9 +172,9 @@ namespace NadekoBot.Modules.Gambling | ||||
|         ////todo DB | ||||
| //        [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
| //        [RequireContext(ContextType.Guild)] | ||||
| //        public async Task Leaderboard(IMessage imsg) | ||||
| //        public async Task Leaderboard(IUserMessage umsg) | ||||
| //        { | ||||
| //            var channel = (ITextChannel)imsg.Channel; | ||||
| //            var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
| //            var richestTemp = DbHandler.Instance.GetTopRichest(); | ||||
| //            var richest = richestTemp as CurrencyState[] ?? richestTemp.ToArray(); | ||||
|   | ||||
| @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Games | ||||
|     { | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Leet(IMessage imsg, int level, [Remainder] string text = null) | ||||
|         public async Task Leet(IUserMessage umsg, int level, [Remainder] string text = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             text = text.Trim(); | ||||
|             if (string.IsNullOrWhiteSpace(text)) | ||||
|   | ||||
| @@ -79,8 +79,8 @@ | ||||
| //                    foreach(var msgToDelete in msgs) | ||||
| //                        await msgToDelete.Delete().ConfigureAwait(false); | ||||
|  | ||||
| //                    await FlowersHandler.AddFlowersAsync(imsg.Author, "Picked a flower.", 1, true).ConfigureAwait(false); | ||||
| //                    var msg = await channel.SendMessageAsync($"**{imsg.Author.Username}** picked a {NadekoBot.Config.CurrencyName}!").ConfigureAwait(false); | ||||
| //                    await FlowersHandler.AddFlowersAsync(umsg.Author, "Picked a flower.", 1, true).ConfigureAwait(false); | ||||
| //                    var msg = await channel.SendMessageAsync($"**{umsg.Author.Username}** picked a {NadekoBot.Config.CurrencyName}!").ConfigureAwait(false); | ||||
| //                    ThreadPool.QueueUserWorkItem(async (state) => | ||||
| //                    { | ||||
| //                        try | ||||
| @@ -104,7 +104,7 @@ | ||||
| //                            await channel.SendMessageAsync($"There is already a {NadekoBot.Config.CurrencyName} in this channel.").ConfigureAwait(false); | ||||
| //                            return; | ||||
| //                        } | ||||
| //                        var removed = await FlowersHandler.RemoveFlowers(imsg.Author, "Planted a flower.", 1, true).ConfigureAwait(false); | ||||
| //                        var removed = await FlowersHandler.RemoveFlowers(umsg.Author, "Planted a flower.", 1, true).ConfigureAwait(false); | ||||
| //                        if (!removed) | ||||
| //                        { | ||||
| //                            await channel.SendMessageAsync($"You don't have any {NadekoBot.Config.CurrencyName}s.").ConfigureAwait(false); | ||||
| @@ -118,7 +118,7 @@ | ||||
| //                        else | ||||
| //                            msg = await e.Channel.SendFile(file).ConfigureAwait(false); | ||||
| //                        var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(NadekoBot.Config.CurrencyName[0]); | ||||
| //                        var msg2 = await channel.SendMessageAsync($"Oh how Nice! **{imsg.Author.Username}** planted {(vowelFirst ? "an" : "a")} {NadekoBot.Config.CurrencyName}. Pick it using {Module.Prefix}pick").ConfigureAwait(false); | ||||
| //                        var msg2 = await channel.SendMessageAsync($"Oh how Nice! **{umsg.Author.Username}** planted {(vowelFirst ? "an" : "a")} {NadekoBot.Config.CurrencyName}. Pick it using {Module.Prefix}pick").ConfigureAwait(false); | ||||
| //                        plantedFlowerChannels.TryAdd(e.Channel.Id, new[] { msg, msg2 }); | ||||
| //                    } | ||||
| //                    finally { locker.Release();  } | ||||
|   | ||||
| @@ -17,11 +17,11 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Poll(IMessage imsg, [Remainder] string arg = null) | ||||
|         public async Task Poll(IUserMessage umsg, [Remainder] string arg = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!(imsg.Author as IGuildUser).GuildPermissions.ManageChannels) | ||||
|             if (!(umsg.Author as IGuildUser).GuildPermissions.ManageChannels) | ||||
|                 return; | ||||
|             if (string.IsNullOrWhiteSpace(arg) || !arg.Contains(";")) | ||||
|                 return; | ||||
| @@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Games | ||||
|             if (data.Length < 3) | ||||
|                 return; | ||||
|  | ||||
|             var poll = new Poll(imsg, data[0], data.Skip(1)); | ||||
|             var poll = new Poll(umsg, data[0], data.Skip(1)); | ||||
|             if (ActivePolls.TryAdd(channel.Guild, poll)) | ||||
|             { | ||||
|                 await poll.StartPoll().ConfigureAwait(false); | ||||
| @@ -38,11 +38,11 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Pollend(IMessage imsg) | ||||
|         public async Task Pollend(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!(imsg.Author as IGuildUser).GuildPermissions.ManageChannels) | ||||
|             if (!(umsg.Author as IGuildUser).GuildPermissions.ManageChannels) | ||||
|                 return; | ||||
|             Poll poll; | ||||
|             ActivePolls.TryGetValue(channel.Guild, out poll); | ||||
| @@ -52,16 +52,16 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|     public class Poll | ||||
|     { | ||||
|         private readonly IMessage imsg; | ||||
|         private readonly IUserMessage umsg; | ||||
|         private readonly string[] answers; | ||||
|         private ConcurrentDictionary<IUser, int> participants = new ConcurrentDictionary<IUser, int>(); | ||||
|         private readonly string question; | ||||
|         private DateTime started; | ||||
|         private CancellationTokenSource pollCancellationSource = new CancellationTokenSource(); | ||||
|  | ||||
|         public Poll(IMessage imsg, string question, IEnumerable<string> enumerable) | ||||
|         public Poll(IUserMessage umsg, string question, IEnumerable<string> enumerable) | ||||
|         { | ||||
|             this.imsg = imsg; | ||||
|             this.umsg = umsg; | ||||
|             this.question = question; | ||||
|             this.answers = enumerable as string[] ?? enumerable.ToArray(); | ||||
|         } | ||||
| @@ -70,13 +70,13 @@ namespace NadekoBot.Modules.Games | ||||
|         { | ||||
|             started = DateTime.Now; | ||||
|             NadekoBot.Client.MessageReceived += Vote; | ||||
|             var msgToSend = $@"📃**{imsg.Author.Username}** has created a poll which requires your attention: | ||||
|             var msgToSend = $@"📃**{umsg.Author.Username}** has created a poll which requires your attention: | ||||
|  | ||||
| **{question}**\n"; | ||||
|             var num = 1; | ||||
|             msgToSend = answers.Aggregate(msgToSend, (current, answ) => current + $"`{num++}.` **{answ}**\n"); | ||||
|             msgToSend += "\n**Private Message me with the corresponding number of the answer.**"; | ||||
|             await imsg.Channel.SendMessageAsync(msgToSend).ConfigureAwait(false); | ||||
|             await umsg.Channel.SendMessageAsync(msgToSend).ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         public async Task StopPoll(IGuildChannel ch) | ||||
| @@ -91,7 +91,7 @@ namespace NadekoBot.Modules.Games | ||||
|                 var totalVotesCast = results.Sum(kvp => kvp.Value); | ||||
|                 if (totalVotesCast == 0) | ||||
|                 { | ||||
|                     await imsg.Channel.SendMessageAsync("📄 **No votes have been cast.**").ConfigureAwait(false); | ||||
|                     await umsg.Channel.SendMessageAsync("📄 **No votes have been cast.**").ConfigureAwait(false); | ||||
|                     return; | ||||
|                 } | ||||
|                 var closeMessage = $"--------------**POLL CLOSED**--------------\n" + | ||||
| @@ -100,7 +100,7 @@ namespace NadekoBot.Modules.Games | ||||
|                                                                                  $" has {kvp.Value} votes." + | ||||
|                                                                                  $"({kvp.Value * 1.0f / totalVotesCast * 100}%)\n"); | ||||
|  | ||||
|                 await imsg.Channel.SendMessageAsync($"📄 **Total votes cast**: {totalVotesCast}\n{closeMessage}").ConfigureAwait(false); | ||||
|                 await umsg.Channel.SendMessageAsync($"📄 **Total votes cast**: {totalVotesCast}\n{closeMessage}").ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
| @@ -108,8 +108,11 @@ namespace NadekoBot.Modules.Games | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private async Task Vote(IMessage msg) | ||||
|         private async Task Vote(IMessage imsg) | ||||
|         { | ||||
|             var msg = imsg as ISystemMessage; | ||||
|             if (msg == null) | ||||
|                 return; | ||||
|             try | ||||
|             { | ||||
|                 IPrivateChannel ch; | ||||
|   | ||||
| @@ -103,16 +103,16 @@ | ||||
| //        { | ||||
| //            try | ||||
| //            { | ||||
| //                if (e.Channel == null || e.Channel.Id != channel.Id || imsg.Author.Id == NadekoBot.Client.CurrentUser.Id) return; | ||||
| //                if (e.Channel == null || e.Channel.Id != channel.Id || umsg.Author.Id == NadekoBot.Client.CurrentUser.Id) return; | ||||
|  | ||||
| //                var guess = e.Message.RawText; | ||||
|  | ||||
| //                var distance = CurrentSentence.LevenshteinDistance(guess); | ||||
| //                var decision = Judge(distance, guess.Length); | ||||
| //                if (decision && !finishedUserIds.Contains(imsg.Author.Id)) | ||||
| //                if (decision && !finishedUserIds.Contains(umsg.Author.Id)) | ||||
| //                { | ||||
| //                    finishedUserIds.Add(imsg.Author.Id); | ||||
| //                    await channel.Send($"{imsg.Author.Mention} finished in **{sw.Elapsed.Seconds}** seconds with { distance } errors, **{ CurrentSentence.Length / WORD_VALUE / sw.Elapsed.Seconds * 60 }** WPM!").ConfigureAwait(false); | ||||
| //                    finishedUserIds.Add(umsg.Author.Id); | ||||
| //                    await channel.Send($"{umsg.Author.Mention} finished in **{sw.Elapsed.Seconds}** seconds with { distance } errors, **{ CurrentSentence.Length / WORD_VALUE / sw.Elapsed.Seconds * 60 }** WPM!").ConfigureAwait(false); | ||||
| //                    if (finishedUserIds.Count % 2 == 0) | ||||
| //                    { | ||||
| //                        await channel.SendMessageAsync($":exclamation: `A lot of people finished, here is the text for those still typing:`\n\n:book:**{CurrentSentence}**:book:").ConfigureAwait(false); | ||||
| @@ -139,7 +139,7 @@ | ||||
| //        public Func<CommandEventArgs, Task> DoFunc() => | ||||
| //            async e => | ||||
| //            { | ||||
| //                var game = RunningContests.GetOrAdd(imsg.Author.Server.Id, id => new TypingGame(e.Channel)); | ||||
| //                var game = RunningContests.GetOrAdd(umsg.Author.Server.Id, id => new TypingGame(e.Channel)); | ||||
|  | ||||
| //                if (game.IsActive) | ||||
| //                { | ||||
| @@ -158,7 +158,7 @@ | ||||
| //            async e => | ||||
| //            { | ||||
| //                TypingGame game; | ||||
| //                if (RunningContests.TryRemove(imsg.Author.Server.Id, out game)) | ||||
| //                if (RunningContests.TryRemove(umsg.Author.Server.Id, out game)) | ||||
| //                { | ||||
| //                    await game.Stop().ConfigureAwait(false); | ||||
| //                    return; | ||||
| @@ -181,7 +181,7 @@ | ||||
| //                .Parameter("text", ParameterType.Unparsed) | ||||
| //                .Do(async e => | ||||
| //                { | ||||
| //                    if (!NadekoBot.IsOwner(imsg.Author.Id) || string.IsNullOrWhiteSpace(text)) return; | ||||
| //                    if (!NadekoBot.IsOwner(umsg.Author.Id) || string.IsNullOrWhiteSpace(text)) return; | ||||
|  | ||||
| //                    DbHandler.Instance.Connection.Insert(new TypingArticle | ||||
| //                    { | ||||
|   | ||||
| @@ -104,19 +104,23 @@ namespace NadekoBot.Modules.Games.Trivia | ||||
|  | ||||
|         private async Task PotentialGuess(IMessage imsg) | ||||
|         { | ||||
|             var umsg = imsg as IUserMessage; | ||||
|             if (umsg == null) | ||||
|                 return; | ||||
|  | ||||
|             try | ||||
|             { | ||||
|                 if (!(imsg.Channel is IGuildChannel && imsg.Channel is ITextChannel)) return; | ||||
|                 if ((imsg.Channel as ITextChannel).Guild != guild) return; | ||||
|                 if (imsg.Author.Id == (await NadekoBot.Client.GetCurrentUserAsync()).Id) return; | ||||
|                 if (!(umsg.Channel is IGuildChannel && umsg.Channel is ITextChannel)) return; | ||||
|                 if ((umsg.Channel as ITextChannel).Guild != guild) return; | ||||
|                 if (umsg.Author.Id == (await NadekoBot.Client.GetCurrentUserAsync()).Id) return; | ||||
|  | ||||
|                 var guildUser = imsg.Author as IGuildUser; | ||||
|                 var guildUser = umsg.Author as IGuildUser; | ||||
|  | ||||
|                 var guess = false; | ||||
|                 await _guessLock.WaitAsync().ConfigureAwait(false); | ||||
|                 try | ||||
|                 { | ||||
|                     if (GameActive && CurrentQuestion.IsAnswerCorrect(imsg.Content) && !triviaCancelSource.IsCancellationRequested) | ||||
|                     if (GameActive && CurrentQuestion.IsAnswerCorrect(umsg.Content) && !triviaCancelSource.IsCancellationRequested) | ||||
|                     { | ||||
|                         Users.AddOrUpdate(guildUser, 0, (gu, old) => old++); | ||||
|                         guess = true; | ||||
|   | ||||
| @@ -19,9 +19,9 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Trivia(IMessage imsg, string[] args) | ||||
|             public async Task Trivia(IUserMessage umsg, string[] args) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 TriviaGame trivia; | ||||
|                 if (!RunningTrivias.TryGetValue(channel.Guild.Id, out trivia)) | ||||
| @@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Games | ||||
|                     }).Where(t => t.Item1).Select(t => t.Item2).FirstOrDefault(); | ||||
|                     if (number < 0) | ||||
|                         return; | ||||
|                     var triviaGame = new TriviaGame(channel.Guild, imsg.Channel as ITextChannel, showHints, number == 0 ? 10 : number); | ||||
|                     var triviaGame = new TriviaGame(channel.Guild, umsg.Channel as ITextChannel, showHints, number == 0 ? 10 : number); | ||||
|                     if (RunningTrivias.TryAdd(channel.Guild.Id, triviaGame)) | ||||
|                         await channel.SendMessageAsync($"**Trivia game started! {triviaGame.WinRequirement} points needed to win.**").ConfigureAwait(false); | ||||
|                     else | ||||
| @@ -46,9 +46,9 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Tl(IMessage imsg) | ||||
|             public async Task Tl(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 TriviaGame trivia; | ||||
|                 if (RunningTrivias.TryGetValue(channel.Guild.Id, out trivia)) | ||||
| @@ -59,9 +59,9 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Tq(IMessage imsg) | ||||
|             public async Task Tq(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 TriviaGame trivia; | ||||
|                 if (RunningTrivias.TryRemove(channel.Guild.Id, out trivia)) | ||||
|   | ||||
| @@ -30,9 +30,9 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Choose(IMessage imsg, [Remainder] string list = null) | ||||
|         public async Task Choose(IUserMessage umsg, [Remainder] string list = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             if (string.IsNullOrWhiteSpace(list)) | ||||
|                 return; | ||||
|             var listArr = list.Split(';'); | ||||
| @@ -44,9 +44,9 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task _8Ball(IMessage imsg, [Remainder] string question = null) | ||||
|         public async Task _8Ball(IUserMessage umsg, [Remainder] string question = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(question)) | ||||
|                 return; | ||||
| @@ -57,9 +57,9 @@ namespace NadekoBot.Modules.Games | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Rps(IMessage imsg, string input) | ||||
|         public async Task Rps(IUserMessage umsg, string input) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             Func<int,string> GetRPSPick = (p) => | ||||
|             { | ||||
| @@ -100,16 +100,16 @@ namespace NadekoBot.Modules.Games | ||||
|                      (pick == 2 && nadekoPick == 0)) | ||||
|                 msg = $"{(await NadekoBot.Client.GetCurrentUserAsync()).Mention} won! :{GetRPSPick(nadekoPick)}: beats :{GetRPSPick(pick)}:"; | ||||
|             else | ||||
|                 msg = $"{imsg.Author.Mention} won! :{GetRPSPick(pick)}: beats :{GetRPSPick(nadekoPick)}:"; | ||||
|                 msg = $"{umsg.Author.Mention} won! :{GetRPSPick(pick)}: beats :{GetRPSPick(nadekoPick)}:"; | ||||
|  | ||||
|             await channel.SendMessageAsync(msg).ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Linux(IMessage imsg, string guhnoo, string loonix) | ||||
|         public async Task Linux(IUserMessage umsg, string guhnoo, string loonix) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendMessageAsync( | ||||
| $@"I'd just like to interject for moment. What you're refering to as {loonix}, is in fact, {guhnoo}/{loonix}, or as I've recently taken to calling it, {guhnoo} plus {loonix}. {loonix} is not an operating system unto itself, but rather another free component of a fully functioning {guhnoo} system made useful by the {guhnoo} corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX. | ||||
|   | ||||
| @@ -27,9 +27,9 @@ namespace NadekoBot.Modules.Help | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Modules(IMessage imsg) | ||||
|         public async Task Modules(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendMessageAsync("`List of modules:` \n• " + string.Join("\n• ", _commands.Modules.Select(m => m.Name)) + $"\n`Type \"-commands module_name\" to get a list of commands in that module.`") | ||||
|                                        .ConfigureAwait(false); | ||||
| @@ -37,9 +37,9 @@ namespace NadekoBot.Modules.Help | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Commands(IMessage imsg, [Remainder] string module = null) | ||||
|         public async Task Commands(IUserMessage umsg, [Remainder] string module = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             module = module?.Trim().ToUpperInvariant(); | ||||
|             if (string.IsNullOrWhiteSpace(module)) | ||||
| @@ -67,14 +67,14 @@ namespace NadekoBot.Modules.Help | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task H(IMessage imsg, [Remainder] string comToFind = null) | ||||
|         public async Task H(IUserMessage umsg, [Remainder] string comToFind = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             comToFind = comToFind?.ToLowerInvariant(); | ||||
|             if (string.IsNullOrWhiteSpace(comToFind)) | ||||
|             { | ||||
|                 await (await (imsg.Author as IGuildUser).CreateDMChannelAsync()).SendMessageAsync(HelpString).ConfigureAwait(false); | ||||
|                 await (await (umsg.Author as IGuildUser).CreateDMChannelAsync()).SendMessageAsync(HelpString).ConfigureAwait(false); | ||||
|                 return; | ||||
|             } | ||||
|             var com = _commands.Commands.FirstOrDefault(c => c.Text.ToLowerInvariant() == comToFind); | ||||
| @@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Help | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Hgit(IMessage imsg) | ||||
|         public async Task Hgit(IUserMessage umsg) | ||||
|         { | ||||
|             var helpstr = new StringBuilder(); | ||||
|  | ||||
| @@ -115,9 +115,9 @@ namespace NadekoBot.Modules.Help | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Guide(IMessage imsg) | ||||
|         public async Task Guide(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendMessageAsync( | ||||
| @"**LIST OF COMMANDS**: <http://nadekobot.readthedocs.io/en/latest/Commands%20List/> | ||||
| @@ -126,9 +126,9 @@ namespace NadekoBot.Modules.Help | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Donate(IMessage imsg) | ||||
|         public async Task Donate(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendMessageAsync( | ||||
| $@"You can support the project on patreon. <https://patreon.com/nadekobot> or | ||||
|   | ||||
| @@ -36,25 +36,25 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Next(IMessage imsg) | ||||
|         public async Task Next(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return; | ||||
|             if (musicPlayer.PlaybackVoiceChannel == ((IGuildUser)imsg.Author).VoiceChannel) | ||||
|             if (musicPlayer.PlaybackVoiceChannel == ((IGuildUser)umsg.Author).VoiceChannel) | ||||
|                 musicPlayer.Next(); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Stop(IMessage imsg) | ||||
|         public async Task Stop(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel == musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel == musicPlayer.PlaybackVoiceChannel) | ||||
|             { | ||||
|                 musicPlayer.Autoplay = false; | ||||
|                 musicPlayer.Stop(); | ||||
| @@ -63,25 +63,25 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Destroy(IMessage imsg) | ||||
|         public async Task Destroy(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryRemove(channel.Guild.Id, out musicPlayer)) return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel == musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel == musicPlayer.PlaybackVoiceChannel) | ||||
|                 musicPlayer.Destroy(); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Pause(IMessage imsg) | ||||
|         public async Task Pause(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|             musicPlayer.TogglePause(); | ||||
|             if (musicPlayer.Paused) | ||||
| @@ -92,37 +92,37 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Queue(IMessage imsg, [Remainder] string query) | ||||
|         public async Task Queue(IUserMessage umsg, [Remainder] string query) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, query).ConfigureAwait(false); | ||||
|             await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, query).ConfigureAwait(false); | ||||
|             if (channel.Guild.GetCurrentUser().GetPermissions(channel).ManageMessages) | ||||
|             { | ||||
|                 await Task.Delay(10000).ConfigureAwait(false); | ||||
|                 await imsg.DeleteAsync().ConfigureAwait(false); | ||||
|                 await ((IUserMessage)umsg).DeleteAsync().ConfigureAwait(false); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task SoundCloudQueue(IMessage imsg, [Remainder] string query) | ||||
|         public async Task SoundCloudQueue(IUserMessage umsg, [Remainder] string query) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, query, musicType: MusicType.Soundcloud).ConfigureAwait(false); | ||||
|             await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, query, musicType: MusicType.Soundcloud).ConfigureAwait(false); | ||||
|             if (channel.Guild.GetCurrentUser().GetPermissions(channel).ManageMessages) | ||||
|             { | ||||
|                 await Task.Delay(10000).ConfigureAwait(false); | ||||
|                 await imsg.DeleteAsync().ConfigureAwait(false); | ||||
|                 await ((IUserMessage)umsg).DeleteAsync().ConfigureAwait(false); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ListQueue(IMessage imsg, int page = 1) | ||||
|         public async Task ListQueue(IUserMessage umsg, int page = 1) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|             { | ||||
| @@ -153,9 +153,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task NowPlaying(IMessage imsg) | ||||
|         public async Task NowPlaying(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
| @@ -168,13 +168,13 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Volume(IMessage imsg, int val) | ||||
|         public async Task Volume(IUserMessage umsg, int val) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|             if (val < 0) | ||||
|                 return; | ||||
| @@ -184,9 +184,9 @@ namespace NadekoBot.Modules.Music | ||||
|         ////todo DB | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Defvol(IMessage imsg, [Remainder] int val) | ||||
|         //public async Task Defvol(IUserMessage umsg, [Remainder] int val) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|         //    var arg = val; | ||||
|         //    float volume; | ||||
|         //    if (!float.TryParse(arg, out volume) || volume < 0 || volume > 100) | ||||
| @@ -201,39 +201,39 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Mute(IMessage imsg) | ||||
|         public async Task Mute(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|             musicPlayer.SetVolume(0); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Max(IMessage imsg) | ||||
|         public async Task Max(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|             musicPlayer.SetVolume(100); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Shuffle(IMessage imsg) | ||||
|         public async Task Shuffle(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|             if (musicPlayer.Playlist.Count < 2) | ||||
|             { | ||||
| @@ -247,13 +247,13 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Playlist(IMessage imsg, [Remainder] string playlist) | ||||
|         public async Task Playlist(IUserMessage umsg, [Remainder] string playlist) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var arg = playlist; | ||||
|             if (string.IsNullOrWhiteSpace(arg)) | ||||
|                 return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel?.Guild != channel.Guild) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel?.Guild != channel.Guild) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.").ConfigureAwait(false); | ||||
|                 return; | ||||
| @@ -278,7 +278,7 @@ namespace NadekoBot.Modules.Music | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, id, true).ConfigureAwait(false); | ||||
|                     await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false); | ||||
|                 } | ||||
|                 catch (PlaylistFullException) | ||||
|                 { break; } | ||||
| @@ -289,9 +289,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task SoundCloudPl(IMessage imsg, [Remainder] string pl) | ||||
|         public async Task SoundCloudPl(IUserMessage umsg, [Remainder] string pl) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             pl = pl?.Trim(); | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(pl)) | ||||
| @@ -300,7 +300,7 @@ namespace NadekoBot.Modules.Music | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
|                 var scvids = JObject.Parse(await http.GetStringAsync($"http://api.soundcloud.com/resolve?url={pl}&client_id={NadekoBot.Credentials.SoundCloudClientId}").ConfigureAwait(false))["tracks"].ToObject<SoundCloudVideo[]>(); | ||||
|                 await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, scvids[0].TrackLink).ConfigureAwait(false); | ||||
|                 await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, scvids[0].TrackLink).ConfigureAwait(false); | ||||
|  | ||||
|                 MusicPlayer mp; | ||||
|                 if (!MusicPlayers.TryGetValue(channel.Guild.Id, out mp)) | ||||
| @@ -317,7 +317,7 @@ namespace NadekoBot.Modules.Music | ||||
|                             Uri = svideo.StreamLink, | ||||
|                             ProviderType = MusicType.Normal, | ||||
|                             Query = svideo.TrackLink, | ||||
|                         }), ((IGuildUser)imsg.Author).Username); | ||||
|                         }), ((IGuildUser)umsg.Author).Username); | ||||
|                     } | ||||
|                     catch (PlaylistFullException) { break; } | ||||
|                 } | ||||
| @@ -326,9 +326,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task LocalPl(IMessage imsg, [Remainder] string directory) | ||||
|         public async Task LocalPl(IUserMessage umsg, [Remainder] string directory) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var arg = directory; | ||||
|             if (string.IsNullOrWhiteSpace(arg)) | ||||
|                 return; | ||||
| @@ -340,7 +340,7 @@ namespace NadekoBot.Modules.Music | ||||
|                 { | ||||
|                     try | ||||
|                     { | ||||
|                         await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, file.FullName, true, MusicType.Local).ConfigureAwait(false); | ||||
|                         await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, file.FullName, true, MusicType.Local).ConfigureAwait(false); | ||||
|                     } | ||||
|                     catch (PlaylistFullException) | ||||
|                     { | ||||
| @@ -355,41 +355,41 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Radio(IMessage imsg, string radio_link) | ||||
|         public async Task Radio(IUserMessage umsg, string radio_link) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel?.Guild != channel.Guild) | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel?.Guild != channel.Guild) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.").ConfigureAwait(false); | ||||
|                 return; | ||||
|             } | ||||
|             await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, radio_link, musicType: MusicType.Radio).ConfigureAwait(false); | ||||
|             await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, radio_link, musicType: MusicType.Radio).ConfigureAwait(false); | ||||
|             if (channel.Guild.GetCurrentUser().GetPermissions(channel).ManageMessages) | ||||
|             { | ||||
|                 await Task.Delay(10000).ConfigureAwait(false); | ||||
|                 await imsg.DeleteAsync().ConfigureAwait(false); | ||||
|                 await ((IUserMessage)umsg).DeleteAsync().ConfigureAwait(false); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Local(IMessage imsg, [Remainder] string path) | ||||
|         public async Task Local(IUserMessage umsg, [Remainder] string path) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var arg = path; | ||||
|             if (string.IsNullOrWhiteSpace(arg)) | ||||
|                 return; | ||||
|             await QueueSong(((IGuildUser)imsg.Author), channel, ((IGuildUser)imsg.Author).VoiceChannel, path, musicType: MusicType.Local).ConfigureAwait(false); | ||||
|             await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, path, musicType: MusicType.Local).ConfigureAwait(false); | ||||
|  | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Move(IMessage imsg) | ||||
|         public async Task Move(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             var voiceChannel = ((IGuildUser)imsg.Author).VoiceChannel; | ||||
|             var voiceChannel = ((IGuildUser)umsg.Author).VoiceChannel; | ||||
|             if (voiceChannel == null || voiceChannel.Guild != channel.Guild || !MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
|             musicPlayer.MoveToVoiceChannel(voiceChannel); | ||||
| @@ -397,16 +397,16 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Remove(IMessage imsg, int num) | ||||
|         public async Task Remove(IUserMessage umsg, int num) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|             { | ||||
|                 return; | ||||
|             } | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|             if (num <= 0 || num > musicPlayer.Playlist.Count) | ||||
|                 return; | ||||
| @@ -417,9 +417,9 @@ namespace NadekoBot.Modules.Music | ||||
|         //todo fix | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Remove(IMessage imsg, string all) | ||||
|         public async Task Remove(IUserMessage umsg, string all) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (all.Trim().ToUpperInvariant() != "ALL") | ||||
|                 return; | ||||
| @@ -432,9 +432,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task MoveSong(IMessage imsg, [Remainder] string fromto) | ||||
|         public async Task MoveSong(IUserMessage umsg, [Remainder] string fromto) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|             { | ||||
| @@ -468,9 +468,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task SetMaxQueue(IMessage imsg, uint size) | ||||
|         public async Task SetMaxQueue(IUserMessage umsg, uint size) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|             { | ||||
| @@ -482,9 +482,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ReptCurSong(IMessage imsg) | ||||
|         public async Task ReptCurSong(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
| @@ -500,9 +500,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task RepeatPl(IMessage imsg) | ||||
|         public async Task RepeatPl(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
| @@ -513,46 +513,46 @@ namespace NadekoBot.Modules.Music | ||||
|         /// | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Save(IMessage imsg, [Remainder] string name) | ||||
|         //public async Task Save(IUserMessage umsg, [Remainder] string name) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //} | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Load(IMessage imsg, [Remainder] string name) | ||||
|         //public async Task Load(IUserMessage umsg, [Remainder] string name) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //} | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Playlists(IMessage imsg, [Remainder] string num) | ||||
|         //public async Task Playlists(IUserMessage umsg, [Remainder] string num) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //} | ||||
|  | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task DeletePlaylist(IMessage imsg, [Remainder] string pl) | ||||
|         //public async Task DeletePlaylist(IUserMessage umsg, [Remainder] string pl) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //} | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Goto(IMessage imsg, int time) | ||||
|         public async Task Goto(IUserMessage umsg, int time) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
|             if (((IGuildUser)imsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|             if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel) | ||||
|                 return; | ||||
|  | ||||
|             if (time < 0) | ||||
| @@ -582,9 +582,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task GetLink(IMessage imsg, int index = 0) | ||||
|         public async Task GetLink(IUserMessage umsg, int index = 0) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
| @@ -617,9 +617,9 @@ namespace NadekoBot.Modules.Music | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Autoplay(IMessage imsg) | ||||
|         public async Task Autoplay(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             MusicPlayer musicPlayer; | ||||
|             if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) | ||||
|                 return; | ||||
| @@ -648,8 +648,8 @@ namespace NadekoBot.Modules.Music | ||||
|                 var mp = new MusicPlayer(voiceCh, vol); | ||||
|  | ||||
|  | ||||
|                 IMessage playingMessage = null; | ||||
|                 IMessage lastFinishedMessage = null; | ||||
|                 IUserMessage playingMessage = null; | ||||
|                 IUserMessage lastFinishedMessage = null; | ||||
|                 mp.OnCompleted += async (s, song) => | ||||
|                 { | ||||
|                     if (song.PrintStatusMessage) | ||||
|   | ||||
| @@ -24,9 +24,9 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Hentai(IMessage imsg, [Remainder] string tag = null) | ||||
|         public async Task Hentai(IUserMessage umsg, [Remainder] string tag = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             tag = tag?.Trim() ?? ""; | ||||
|  | ||||
| @@ -43,9 +43,9 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Danbooru(IMessage imsg, [Remainder] string tag = null) | ||||
|         public async Task Danbooru(IUserMessage umsg, [Remainder] string tag = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             tag = tag?.Trim() ?? ""; | ||||
|             var link = await GetDanbooruImageLink(tag).ConfigureAwait(false); | ||||
| @@ -57,9 +57,9 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Gelbooru(IMessage imsg, [Remainder] string tag = null) | ||||
|         public async Task Gelbooru(IUserMessage umsg, [Remainder] string tag = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             tag = tag?.Trim() ?? ""; | ||||
|             var link = await GetRule34ImageLink(tag).ConfigureAwait(false); | ||||
| @@ -71,9 +71,9 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Rule34(IMessage imsg, [Remainder] string tag = null) | ||||
|         public async Task Rule34(IUserMessage umsg, [Remainder] string tag = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             tag = tag?.Trim() ?? ""; | ||||
|             var link = await GetGelbooruImageLink(tag).ConfigureAwait(false); | ||||
| @@ -85,9 +85,9 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task E621(IMessage imsg, [Remainder] string tag = null) | ||||
|         public async Task E621(IUserMessage umsg, [Remainder] string tag = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             tag = tag?.Trim() ?? ""; | ||||
|             var link = await GetE621ImageLink(tag).ConfigureAwait(false); | ||||
| @@ -99,18 +99,18 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Cp(IMessage imsg) | ||||
|         public async Task Cp(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendMessageAsync("http://i.imgur.com/MZkY1md.jpg").ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Boobs(IMessage imsg) | ||||
|         public async Task Boobs(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             try | ||||
|             { | ||||
|                 JToken obj; | ||||
| @@ -128,9 +128,9 @@ namespace NadekoBot.Modules.NSFW | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Butts(IMessage imsg) | ||||
|         public async Task Butts(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             try | ||||
|             { | ||||
|   | ||||
| @@ -17,9 +17,9 @@ namespace NadekoBot.Modules.Games | ||||
|         //todo Dragon should PR this in | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Poke(IMessage imsg) | ||||
|         public async Task Poke(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|         } | ||||
|   | ||||
| @@ -13,11 +13,11 @@ | ||||
| //    { | ||||
| //        [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
| //        [RequireContext(ContextType.Guild)] | ||||
| //        public async Task Anime(IMessage imsg, [Remainder] string query = null) | ||||
| //        public async Task Anime(IUserMessage umsg, [Remainder] string query = null) | ||||
| //        { | ||||
| //            var channel = (ITextChannel)imsg.Channel; | ||||
| //            var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
| //            if (!(await ValidateQuery(imsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
| //            if (!(await ValidateQuery(umsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
| //            string result; | ||||
| //            try | ||||
| //            { | ||||
| @@ -34,11 +34,11 @@ | ||||
|  | ||||
| //        [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
| //        [RequireContext(ContextType.Guild)] | ||||
| //        public async Task Manga(IMessage imsg, [Remainder] string query = null) | ||||
| //        public async Task Manga(IUserMessage umsg, [Remainder] string query = null) | ||||
| //        { | ||||
| //            var channel = (ITextChannel)imsg.Channel; | ||||
| //            var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
| //            if (!(await ValidateQuery(imsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
| //            if (!(await ValidateQuery(umsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
| //            string result; | ||||
| //            try | ||||
| //            { | ||||
|   | ||||
| @@ -16,7 +16,7 @@ namespace NadekoBot.Modules.Searches | ||||
|     { | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public static async Task Calculate(IMessage msg, [Remainder] string expression) | ||||
|         public static async Task Calculate(IUserMessage msg, [Remainder] string expression) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
| @@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task CalcOps(IMessage msg) | ||||
|         public async Task CalcOps(IUserMessage msg) | ||||
|         { | ||||
|             StringBuilder builder = new StringBuilder(); | ||||
|             var selection = typeof(Math).GetTypeInfo().GetMethods().Except(typeof(object).GetTypeInfo().GetMethods()).Select(x => | ||||
|   | ||||
| @@ -44,9 +44,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Yomama(IMessage imsg) | ||||
|             public async Task Yomama(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 using (var http = new HttpClient()) | ||||
|                 { | ||||
|                     var response = await http.GetStringAsync("http://api.yomomma.info/").ConfigureAwait(false); | ||||
| @@ -56,9 +56,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Randjoke(IMessage imsg) | ||||
|             public async Task Randjoke(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 using (var http = new HttpClient()) | ||||
|                 { | ||||
|                     var response = await http.GetStringAsync("http://tambal.azurewebsites.net/joke/random").ConfigureAwait(false); | ||||
| @@ -68,9 +68,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task ChuckNorris(IMessage imsg) | ||||
|             public async Task ChuckNorris(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 using (var http = new HttpClient()) | ||||
|                 { | ||||
|                     var response = await http.GetStringAsync("http://api.icndb.com/jokes/random/").ConfigureAwait(false); | ||||
| @@ -80,9 +80,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task WowJoke(IMessage imsg) | ||||
|             public async Task WowJoke(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 if (!wowJokes.Any()) | ||||
|                 { | ||||
| @@ -92,9 +92,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task MagicItem(IMessage imsg) | ||||
|             public async Task MagicItem(IUserMessage umsg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 var rng = new Random(); | ||||
|                 var item = magicItems[rng.Next(0, magicItems.Count)].ToString(); | ||||
|  | ||||
|   | ||||
| @@ -33,9 +33,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Lolban(IMessage imsg) | ||||
|         public async Task Lolban(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -17,9 +17,9 @@ namespace NadekoBot.Modules.Searches | ||||
|     { | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Memelist(IMessage imsg) | ||||
|         public async Task Memelist(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
|                 var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(await http.GetStringAsync("http://memegen.link/templates/")) | ||||
| @@ -31,9 +31,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Memegen(IMessage imsg, string meme, string topText, string botText) | ||||
|         public async Task Memegen(IUserMessage umsg, string meme, string topText, string botText) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var top = Uri.EscapeDataString(topText.Replace(' ', '-')); | ||||
|             var bot = Uri.EscapeDataString(botText.Replace(' ', '-')); | ||||
|   | ||||
| @@ -27,9 +27,9 @@ namespace NadekoBot.Modules.Searches | ||||
|             } | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Osu(IMessage imsg, string usr, string mode) | ||||
|             public async Task Osu(IUserMessage umsg, string usr, string mode) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 if (string.IsNullOrWhiteSpace(usr)) | ||||
|                     return; | ||||
| @@ -60,9 +60,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Osub(IMessage imsg, [Remainder] string map) | ||||
|             public async Task Osub(IUserMessage umsg, [Remainder] string map) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.OsuApiKey)) | ||||
|                 { | ||||
| @@ -97,9 +97,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Osu5(IMessage imsg, string user, [Remainder] string mode) | ||||
|             public async Task Osu5(IUserMessage umsg, string user, [Remainder] string mode) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|                 if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.OsuApiKey)) | ||||
|                 { | ||||
|                     await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false); | ||||
|   | ||||
| @@ -41,9 +41,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Pokemon(IMessage imsg, [Remainder] string pokemon = null) | ||||
|             public async Task Pokemon(IUserMessage umsg, [Remainder] string pokemon = null) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 pokemon = pokemon?.Trim().ToUpperInvariant(); | ||||
|                 if (string.IsNullOrWhiteSpace(pokemon)) | ||||
| @@ -62,9 +62,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task PokemonAbility(IMessage imsg, [Remainder] string ability = null) | ||||
|             public async Task PokemonAbility(IUserMessage umsg, [Remainder] string ability = null) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 ability = ability?.Trim().ToUpperInvariant().Replace(" ", ""); | ||||
|                 if (string.IsNullOrWhiteSpace(ability)) | ||||
|   | ||||
| @@ -258,7 +258,7 @@ | ||||
|  | ||||
| //                        config.ObservingStreams.Remove(toRemove); | ||||
| //                        await ConfigHandler.SaveConfig().ConfigureAwait(false); | ||||
| //                        await channel.SendMessageAsync($":ok: Removed `{toRemovimsg.Authorname}`'s stream from notifications.").ConfigureAwait(false); | ||||
| //                        await channel.SendMessageAsync($":ok: Removed `{toRemovumsg.Authorname}`'s stream from notifications.").ConfigureAwait(false); | ||||
| //                    }); | ||||
|  | ||||
| //                cgb.CreateCommand(Module.Prefix + "liststreams") | ||||
|   | ||||
| @@ -28,9 +28,9 @@ namespace NadekoBot.Modules.Searches | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Weather(IMessage imsg, string city, string country) | ||||
|         public async Task Weather(IUserMessage umsg, string city, string country) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             city = city.Replace(" ", ""); | ||||
|             country = city.Replace(" ", ""); | ||||
|             string response; | ||||
| @@ -49,10 +49,10 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Youtube(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task Youtube(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             if (!(await ValidateQuery(imsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             if (!(await ValidateQuery(umsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
|             var result = (await _google.GetVideosByKeywordsAsync(query, 1)).FirstOrDefault(); | ||||
|             if (string.IsNullOrWhiteSpace(result)) | ||||
|             { | ||||
| @@ -64,12 +64,12 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Imdb(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task Imdb(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (!(await ValidateQuery(imsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
|             await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|             if (!(await ValidateQuery(umsg.Channel as ITextChannel, query).ConfigureAwait(false))) return; | ||||
|             await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|             string result; | ||||
|             try | ||||
|             { | ||||
| @@ -88,9 +88,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task RandomCat(IMessage imsg) | ||||
|         public async Task RandomCat(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
|                 await channel.SendMessageAsync(JObject.Parse( | ||||
| @@ -101,9 +101,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task RandomDog(IMessage imsg) | ||||
|         public async Task RandomDog(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("http://random.dog/" + await http.GetStringAsync("http://random.dog/woof").ConfigureAwait(false)).ConfigureAwait(false); | ||||
| @@ -112,9 +112,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task I(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task I(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(query)) | ||||
|                 return; | ||||
| @@ -142,9 +142,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Ir(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task Ir(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(query)) | ||||
|                 return; | ||||
| @@ -174,9 +174,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Lmgtfy(IMessage imsg, [Remainder] string ffs = null) | ||||
|         public async Task Lmgtfy(IUserMessage umsg, [Remainder] string ffs = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(ffs)) | ||||
| @@ -188,9 +188,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Google(IMessage imsg, [Remainder] string terms = null) | ||||
|         public async Task Google(IUserMessage umsg, [Remainder] string terms = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|             terms = terms?.Trim(); | ||||
| @@ -202,16 +202,16 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|         ////todo drawing | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Hearthstone(IMessage imsg, [Remainder] string name = null) | ||||
|         //public async Task Hearthstone(IUserMessage umsg, [Remainder] string name = null) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|         //    var arg = name; | ||||
|         //    if (string.IsNullOrWhiteSpace(arg)) | ||||
|         //    { | ||||
|         //        await channel.SendMessageAsync("💢 Please enter a card name to search for.").ConfigureAwait(false); | ||||
|         //        return; | ||||
|         //    } | ||||
|         //    await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|         //    await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|         //    string response = ""; | ||||
|         //    using (var http = new HttpClient()) | ||||
|         //    { | ||||
| @@ -247,9 +247,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Ud(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task Ud(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var arg = query; | ||||
|             if (string.IsNullOrWhiteSpace(arg)) | ||||
| @@ -257,7 +257,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|                 await channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false); | ||||
|                 return; | ||||
|             } | ||||
|             await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|             await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
|                 http.DefaultRequestHeaders.Clear(); | ||||
| @@ -281,9 +281,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Hashtag(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task Hashtag(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var arg = query; | ||||
|             if (string.IsNullOrWhiteSpace(arg)) | ||||
| @@ -291,7 +291,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|                 await channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false); | ||||
|                 return; | ||||
|             } | ||||
|             await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|             await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|             string res = ""; | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
| @@ -316,9 +316,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Catfact(IMessage imsg) | ||||
|         public async Task Catfact(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             using (var http = new HttpClient()) | ||||
|             { | ||||
|                 var response = await http.GetStringAsync("http://catfacts-api.appspot.com/api/facts").ConfigureAwait(false); | ||||
| @@ -330,9 +330,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Revav(IMessage imsg, [Remainder] string arg = null) | ||||
|         public async Task Revav(IUserMessage umsg, [Remainder] string arg = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var usrStr = arg?.Trim().ToUpperInvariant(); | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(usrStr)) | ||||
| @@ -347,9 +347,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Revimg(IMessage imsg, [Remainder] string imageLink = null) | ||||
|         public async Task Revimg(IUserMessage umsg, [Remainder] string imageLink = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             imageLink = imageLink?.Trim() ?? ""; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(imageLink)) | ||||
| @@ -359,9 +359,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Safebooru(IMessage imsg, [Remainder] string tag = null) | ||||
|         public async Task Safebooru(IUserMessage umsg, [Remainder] string tag = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             tag = tag?.Trim() ?? ""; | ||||
|             var link = await GetSafebooruImageLink(tag).ConfigureAwait(false); | ||||
| @@ -373,9 +373,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Wiki(IMessage imsg, [Remainder] string query = null) | ||||
|         public async Task Wiki(IUserMessage umsg, [Remainder] string query = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             query = query?.Trim(); | ||||
|             if (string.IsNullOrWhiteSpace(query)) | ||||
| @@ -394,9 +394,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|         ////todo drawing | ||||
|         //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         //[RequireContext(ContextType.Guild)] | ||||
|         //public async Task Clr(IMessage imsg, [Remainder] string color = null) | ||||
|         //public async Task Clr(IUserMessage umsg, [Remainder] string color = null) | ||||
|         //{ | ||||
|         //    var channel = (ITextChannel)imsg.Channel; | ||||
|         //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|         //    color = color?.Trim().Replace("#", ""); | ||||
|         //    if (string.IsNullOrWhiteSpace((string)color)) | ||||
| @@ -419,13 +419,13 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Videocall(IMessage imsg, [Remainder] string arg = null) | ||||
|         public async Task Videocall(IUserMessage umsg, [Remainder] string arg = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             try | ||||
|             { | ||||
|                 var allUsrs = imsg.MentionedUsers.Append(imsg.Author); | ||||
|                 var allUsrs = umsg.MentionedUsers.Append(umsg.Author); | ||||
|                 var allUsrsArray = allUsrs.ToArray(); | ||||
|                 var str = allUsrsArray.Aggregate("http://appear.in/", (current, usr) => current + Uri.EscapeUriString(usr.Username[0].ToString())); | ||||
|                 str += new Random().Next(); | ||||
| @@ -442,11 +442,11 @@ $@"🌍 **Weather for** 【{obj["target"]}】 | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Avatar(IMessage imsg, [Remainder] string mention = null) | ||||
|         public async Task Avatar(IUserMessage umsg, [Remainder] string mention = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var usr = imsg.MentionedUsers.FirstOrDefault(); | ||||
|             var usr = umsg.MentionedUsers.FirstOrDefault(); | ||||
|             if (usr == null) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("Invalid user specified.").ConfigureAwait(false); | ||||
|   | ||||
| @@ -18,9 +18,9 @@ namespace NadekoBot.Modules.Translator | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Translate(IMessage imsg, string langs, [Remainder] string text = null) | ||||
|         public async Task Translate(IUserMessage umsg, string langs, [Remainder] string text = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             try | ||||
|             { | ||||
| @@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Translator | ||||
|                 if (string.IsNullOrWhiteSpace(text)) | ||||
|                     return; | ||||
|  | ||||
|                 await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|                 await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); | ||||
|                 string translation = await GoogleTranslator.Instance.Translate(text, from, to).ConfigureAwait(false); | ||||
|                 await channel.SendMessageAsync(translation).ConfigureAwait(false); | ||||
|             } | ||||
| @@ -46,9 +46,9 @@ namespace NadekoBot.Modules.Translator | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Translangs(IMessage imsg) | ||||
|         public async Task Translangs(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendTableAsync(GoogleTranslator.Instance.Languages, str => $"{str,-15}", columns: 3); | ||||
|         } | ||||
|   | ||||
| @@ -75,7 +75,7 @@ | ||||
| //                    .Parameter("board_id", Discord.Commands.ParameterType.Required) | ||||
| //                    .Do(async e => | ||||
| //                    { | ||||
| //                        if (!NadekoBot.IsOwner(imsg.Author.Id)) return; | ||||
| //                        if (!NadekoBot.IsOwner(umsg.Author.Id)) return; | ||||
| //                        if (bound != null) return; | ||||
| //                        try | ||||
| //                        { | ||||
| @@ -95,7 +95,7 @@ | ||||
| //                    .Description($"Unbinds a bot from the channel and board. **Bot Owner Only!**| `{Prefix}unbind`") | ||||
| //                    .Do(async e => | ||||
| //                    { | ||||
| //                        if (!NadekoBot.IsOwner(imsg.Author.Id)) return; | ||||
| //                        if (!NadekoBot.IsOwner(umsg.Author.Id)) return; | ||||
| //                        if (bound == null || bound != e.Channel) return; | ||||
| //                        t.Stop(); | ||||
| //                        bound = null; | ||||
| @@ -109,7 +109,7 @@ | ||||
| //                    .Description($"Lists all lists, yo ;) **Bot Owner Only!**| `{Prefix}list`") | ||||
| //                    .Do(async e => | ||||
| //                    { | ||||
| //                        if (!NadekoBot.IsOwner(imsg.Author.Id)) return; | ||||
| //                        if (!NadekoBot.IsOwner(umsg.Author.Id)) return; | ||||
| //                        if (bound == null || board == null || bound != e.Channel) return; | ||||
| //                        await channel.SendMessageAsync("Lists for a board '" + board.Name + "'\n" + string.Join("\n", board.Lists.Select(l => "**• " + l.ToString() + "**"))) | ||||
| //                                       .ConfigureAwait(false); | ||||
| @@ -120,7 +120,7 @@ | ||||
| //                    .Parameter("list_name", Discord.Commands.ParameterType.Unparsed) | ||||
| //                    .Do(async e => | ||||
| //                    { | ||||
| //                        if (!NadekoBot.IsOwner(imsg.Author.Id)) return; | ||||
| //                        if (!NadekoBot.IsOwner(umsg.Author.Id)) return; | ||||
| //                        if (bound == null || board == null || bound != e.Channel || list_name == null) return; | ||||
|  | ||||
| //                        int num; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ namespace NadekoBot.Modules.Utility | ||||
|     { | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ServerInfo(IMessage msg, string guild = null) | ||||
|         public async Task ServerInfo(IUserMessage msg, string guild = null) | ||||
|         { | ||||
|             var channel = msg.Channel as ITextChannel; | ||||
|             guild = guild?.ToUpperInvariant(); | ||||
| @@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ChannelInfo(IMessage msg, ITextChannel channel = null) | ||||
|         public async Task ChannelInfo(IUserMessage msg, ITextChannel channel = null) | ||||
|         { | ||||
|             var ch = channel ?? msg.Channel as ITextChannel; | ||||
|             if (ch == null) | ||||
| @@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task UserInfo(IMessage msg, IGuildUser usr = null) | ||||
|         public async Task UserInfo(IUserMessage msg, IGuildUser usr = null) | ||||
|         { | ||||
|             var channel = msg.Channel as ITextChannel; | ||||
|             var user = usr ?? msg.Author as IGuildUser; | ||||
|   | ||||
| @@ -16,9 +16,9 @@ namespace NadekoBot.Modules.Utility | ||||
|     { | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ShowQuote(IMessage imsg, string keyword) | ||||
|         public async Task ShowQuote(IUserMessage umsg, string keyword) | ||||
|         { | ||||
|             var channel = imsg.Channel as ITextChannel; | ||||
|             var channel = umsg.Channel as ITextChannel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(keyword)) | ||||
|                 return; | ||||
| @@ -39,9 +39,9 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task AddQuote(IMessage imsg, string keyword, [Remainder] string text) | ||||
|         public async Task AddQuote(IUserMessage umsg, string keyword, [Remainder] string text) | ||||
|         { | ||||
|             var channel = imsg.Channel as ITextChannel; | ||||
|             var channel = umsg.Channel as ITextChannel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text)) | ||||
|                 return; | ||||
| @@ -52,8 +52,8 @@ namespace NadekoBot.Modules.Utility | ||||
|             { | ||||
|                 uow.Quotes.Add(new Quote | ||||
|                 { | ||||
|                     AuthorId = imsg.Author.Id, | ||||
|                     AuthorName = imsg.Author.Username, | ||||
|                     AuthorId = umsg.Author.Id, | ||||
|                     AuthorName = umsg.Author.Username, | ||||
|                     GuildId = channel.Guild.Id, | ||||
|                     Keyword = keyword, | ||||
|                     Text = text, | ||||
| @@ -65,9 +65,9 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task DeleteQuote(IMessage imsg, string keyword) | ||||
|         public async Task DeleteQuote(IUserMessage umsg, string keyword) | ||||
|         { | ||||
|             var channel = imsg.Channel as ITextChannel; | ||||
|             var channel = umsg.Channel as ITextChannel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(keyword)) | ||||
|                 return; | ||||
| @@ -92,9 +92,9 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task DelAllQuotes(IMessage imsg, string keyword) | ||||
|         public async Task DelAllQuotes(IUserMessage umsg, string keyword) | ||||
|         { | ||||
|             var channel = imsg.Channel as ITextChannel; | ||||
|             var channel = umsg.Channel as ITextChannel; | ||||
|  | ||||
|             if (string.IsNullOrWhiteSpace(keyword)) | ||||
|                 return; | ||||
|   | ||||
| @@ -99,9 +99,9 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Remind(IMessage imsg, string meorchannel, string timeStr, [Remainder] string message) | ||||
|             public async Task Remind(IUserMessage umsg, string meorchannel, string timeStr, [Remainder] string message) | ||||
|             { | ||||
|                 var channel = (ITextChannel)imsg.Channel; | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|                 var meorchStr = meorchannel.ToUpperInvariant(); | ||||
|                 IMessageChannel ch; | ||||
| @@ -109,7 +109,7 @@ namespace NadekoBot.Modules.Utility | ||||
|                 if (meorchStr == "ME") | ||||
|                 { | ||||
|                     isPrivate = true; | ||||
|                     ch = await ((IGuildUser)imsg.Author).CreateDMChannelAsync().ConfigureAwait(false); | ||||
|                     ch = await ((IGuildUser)umsg.Author).CreateDMChannelAsync().ConfigureAwait(false); | ||||
|                 } | ||||
|                 else if (meorchStr == "HERE") | ||||
|                 { | ||||
| @@ -122,7 +122,7 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|                 if (ch == null) | ||||
|                 { | ||||
|                     await channel.SendMessageAsync($"{imsg.Author.Mention} Something went wrong (channel cannot be found) ;(").ConfigureAwait(false); | ||||
|                     await channel.SendMessageAsync($"{umsg.Author.Mention} Something went wrong (channel cannot be found) ;(").ConfigureAwait(false); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
| @@ -175,7 +175,7 @@ namespace NadekoBot.Modules.Utility | ||||
|                     IsPrivate = isPrivate, | ||||
|                     When = time, | ||||
|                     Message = message, | ||||
|                     UserId = imsg.Author.Id, | ||||
|                     UserId = umsg.Author.Id, | ||||
|                     ServerId = channel.Guild.Id | ||||
|                 }; | ||||
|  | ||||
| @@ -185,16 +185,16 @@ namespace NadekoBot.Modules.Utility | ||||
|                     await uow.CompleteAsync(); | ||||
|                 } | ||||
|  | ||||
|                 await channel.SendMessageAsync($"⏰ I will remind \"{(ch is ITextChannel ? ((ITextChannel)ch).Name : imsg.Author.Username)}\" to \"{message.ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false); | ||||
|                 await channel.SendMessageAsync($"⏰ I will remind \"{(ch is ITextChannel ? ((ITextChannel)ch).Name : umsg.Author.Username)}\" to \"{message.ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false); | ||||
|                 await StartReminder(rem); | ||||
|             } | ||||
|  | ||||
|             ////todo owner only | ||||
|             //[LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             //[RequireContext(ContextType.Guild)] | ||||
|             //public async Task RemindTemplate(IMessage imsg, [Remainder] string arg) | ||||
|             //public async Task RemindTemplate(IUserMessage umsg, [Remainder] string arg) | ||||
|             //{ | ||||
|             //    var channel = (ITextChannel)imsg.Channel; | ||||
|             //    var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|  | ||||
|             //    arg = arg?.Trim(); | ||||
|   | ||||
| @@ -25,13 +25,13 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task WhosPlaying(IMessage imsg, [Remainder] string game = null) | ||||
|         public async Task WhosPlaying(IUserMessage umsg, [Remainder] string game = null) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             game = game.Trim().ToUpperInvariant(); | ||||
|             if (string.IsNullOrWhiteSpace(game)) | ||||
|                 return; | ||||
|             var arr = (await (imsg.Channel as IGuildChannel).Guild.GetUsersAsync()) | ||||
|             var arr = (await (umsg.Channel as IGuildChannel).Guild.GetUsersAsync()) | ||||
|                     .Where(u => u.Game?.Name?.ToUpperInvariant() == game) | ||||
|                     .Select(u => u.Username) | ||||
|                     .ToList(); | ||||
| @@ -45,11 +45,11 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task InRole(IMessage imsg, [Remainder] string roles = null) | ||||
|         public async Task InRole(IUserMessage umsg, [Remainder] string roles = null) | ||||
|         { | ||||
|             if (string.IsNullOrWhiteSpace(roles)) | ||||
|                 return; | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|             var arg = roles.Split(',').Select(r => r.Trim().ToUpperInvariant()); | ||||
|             string send = _l["`Here is a list of users in a specfic role:`"]; | ||||
|             foreach (var roleStr in arg.Where(str => !string.IsNullOrWhiteSpace(str) && str != "@EVERYONE" && str != "EVERYONE")) | ||||
| @@ -57,14 +57,14 @@ namespace NadekoBot.Modules.Utility | ||||
|                 var role = channel.Guild.Roles.Where(r => r.Name.ToUpperInvariant() == roleStr).FirstOrDefault(); | ||||
|                 if (role == null) continue; | ||||
|                 send += $"\n`{role.Name}`\n"; | ||||
|                 send += string.Join(", ", (await channel.Guild.GetUsersAsync()).Where(u => u.Roles.Contains(role)).Select(u => u.ToString())); | ||||
|                 send += string.Join(", ", channel.Guild.GetUsers().Where(u => u.Roles.Contains(role)).Select(u => u.ToString())); | ||||
|             } | ||||
|             var usr = imsg.Author as IGuildUser; | ||||
|             var usr = umsg.Author as IGuildUser; | ||||
|             while (send.Length > 2000) | ||||
|             { | ||||
|                 if (!usr.GetPermissions(channel).ManageMessages) | ||||
|                 { | ||||
|                     await channel.SendMessageAsync($"{usr.Mention} you are not allowed to use this command on roles with a lot of users in them to prevent abuse."); | ||||
|                     await channel.SendMessageAsync($"{usr.Mention} you are not allowed to use this command on roles with a lot of users in them to prevent abuse.").ConfigureAwait(false); | ||||
|                     return; | ||||
|                 } | ||||
|                 var curstr = send.Substring(0, 2000); | ||||
| @@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task CheckMyPerms(IMessage msg) | ||||
|         public async Task CheckMyPerms(IUserMessage msg) | ||||
|         { | ||||
|  | ||||
|             StringBuilder builder = new StringBuilder("```\n"); | ||||
| @@ -95,28 +95,28 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task UserId(IMessage msg, IGuildUser target = null) | ||||
|         public async Task UserId(IUserMessage msg, IGuildUser target = null) | ||||
|         { | ||||
|             var usr = target ?? msg.Author; | ||||
|             await msg.Reply($"Id of the user { usr.Username } is { usr.Id })"); | ||||
|             await msg.Reply($"Id of the user { usr.Username } is { usr.Id })").ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         public async Task ChannelId(IMessage msg) | ||||
|         public async Task ChannelId(IUserMessage msg) | ||||
|         { | ||||
|             await msg.Reply($"This Channel's ID is {msg.Channel.Id}"); | ||||
|             await msg.Reply($"This Channel's ID is {msg.Channel.Id}").ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ServerId(IMessage msg) | ||||
|         public async Task ServerId(IUserMessage msg) | ||||
|         { | ||||
|             await msg.Reply($"This server's ID is {(msg.Channel as ITextChannel).Guild.Id}"); | ||||
|             await msg.Reply($"This server's ID is {(msg.Channel as ITextChannel).Guild.Id}").ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Roles(IMessage msg, IGuildUser target = null) | ||||
|         public async Task Roles(IUserMessage msg, IGuildUser target = null) | ||||
|         { | ||||
|             var guild = (msg.Channel as ITextChannel).Guild; | ||||
|             if (target != null) | ||||
| @@ -131,9 +131,9 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task ChannelTopic(IMessage imsg) | ||||
|         public async Task ChannelTopic(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             var topic = channel.Topic; | ||||
|             if (string.IsNullOrWhiteSpace(topic)) | ||||
| @@ -144,9 +144,9 @@ namespace NadekoBot.Modules.Utility | ||||
|  | ||||
|         [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task Stats(IMessage imsg) | ||||
|         public async Task Stats(IUserMessage umsg) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             var channel = (ITextChannel)umsg.Channel; | ||||
|  | ||||
|             await channel.SendMessageAsync(await NadekoBot.Stats.Print()); | ||||
|         } | ||||
|   | ||||
| @@ -88,15 +88,18 @@ namespace NadekoBot | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private Task Client_MessageReceived(IMessage imsg) | ||||
|         private Task Client_MessageReceived(IMessage umsg) | ||||
|         { | ||||
|             var usrMsg = umsg as IUserMessage; | ||||
|             if (usrMsg == null) | ||||
|                 return Task.CompletedTask; | ||||
|             var throwaway = Task.Run(async () => | ||||
|             { | ||||
|                 var sw = new Stopwatch(); | ||||
|                 sw.Start(); | ||||
|                 var t = await Commands.Execute(imsg, imsg.Content); | ||||
|                 var t = await Commands.Execute(usrMsg, usrMsg.Content); | ||||
|                 sw.Stop(); | ||||
|                 var channel = (imsg.Channel as ITextChannel); | ||||
|                 var channel = (umsg.Channel as ITextChannel); | ||||
|                 if (t.IsSuccess) | ||||
|                 { | ||||
|  | ||||
| @@ -105,10 +108,10 @@ namespace NadekoBot | ||||
|                               "Server: {1}\n\t" + | ||||
|                               "Channel: {2}\n\t" + | ||||
|                               "Message: {3}", | ||||
|                               imsg.Author + " [" + imsg.Author.Id + "]", // {0} | ||||
|                               umsg.Author + " [" + umsg.Author.Id + "]", // {0} | ||||
|                               (channel == null ? "PRIVATE" : channel.Guild.Name + " [" + channel.Guild.Id + "]"), // {1} | ||||
|                               (channel == null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), //{2} | ||||
|                               imsg.Content, // {3} | ||||
|                               umsg.Content, // {3} | ||||
|                               sw.Elapsed.TotalSeconds // {4} | ||||
|                               ); | ||||
|                 } | ||||
| @@ -120,10 +123,10 @@ namespace NadekoBot | ||||
|                               "Channel: {2}\n\t" + | ||||
|                               "Message: {3}\n\t" +  | ||||
|                               "Error: {4}", | ||||
|                               imsg.Author + " [" + imsg.Author.Id + "]", // {0} | ||||
|                               umsg.Author + " [" + umsg.Author.Id + "]", // {0} | ||||
|                               (channel == null ? "PRIVATE" : channel.Guild.Name + " [" + channel.Guild.Id + "]"), // {1} | ||||
|                               (channel == null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), //{2} | ||||
|                               imsg.Content,// {3} | ||||
|                               umsg.Content,// {3} | ||||
|                               t.ErrorReason, // {4} | ||||
|                               sw.Elapsed.TotalSeconds //{5} | ||||
|                               ); | ||||
|   | ||||
| @@ -24,29 +24,29 @@ namespace NadekoBot.Extensions | ||||
|  | ||||
|         public static double UnixTimestamp(this DateTime dt) => dt.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds; | ||||
|  | ||||
|         public static async Task<IMessage> SendMessageAsync(this IGuildUser user, string message, bool isTTS = false) => | ||||
|         public static async Task<IUserMessage> SendMessageAsync(this IGuildUser user, string message, bool isTTS = false) => | ||||
|             await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(message, isTTS).ConfigureAwait(false); | ||||
|  | ||||
|         public static async Task<IMessage> SendFileAsync(this IGuildUser user, string filePath, string caption = null, bool isTTS = false) => | ||||
|         public static async Task<IUserMessage> SendFileAsync(this IGuildUser user, string filePath, string caption = null, bool isTTS = false) => | ||||
|             await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, caption, isTTS).ConfigureAwait(false); | ||||
|  | ||||
|         public static async Task<IMessage> SendFileAsync(this IGuildUser user, Stream fileStream, string fileName, string caption = null, bool isTTS = false) => | ||||
|         public static async Task<IUserMessage> SendFileAsync(this IGuildUser user, Stream fileStream, string fileName, string caption = null, bool isTTS = false) => | ||||
|             await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(fileStream, fileName, caption, isTTS).ConfigureAwait(false); | ||||
|  | ||||
|         public static async Task<IMessage> Reply(this IMessage msg, string content) =>  | ||||
|         public static async Task<IUserMessage> Reply(this IUserMessage msg, string content) =>  | ||||
|             await msg.Channel.SendMessageAsync(content).ConfigureAwait(false); | ||||
|  | ||||
|         public static Task<bool> IsAuthor(this IMessage msg) => | ||||
|         public static Task<bool> IsAuthor(this IUserMessage msg) => | ||||
|             Task.FromResult(NadekoBot.Client.GetCurrentUser().Id == msg.Author.Id); | ||||
|  | ||||
|         public static IEnumerable<IUser> Members(this IRole role) => | ||||
|             NadekoBot.Client.GetGuilds().Where(g => g.Id == role.GuildId).FirstOrDefault()?.GetUsers().Where(u => u.Roles.Contains(role)) ?? Enumerable.Empty<IUser>(); | ||||
|  | ||||
|         public static async Task<IMessage[]> ReplyLong(this IMessage msg, string content, string breakOn = "\n", string addToEnd = "", string addToStart = "") | ||||
|         public static async Task<IUserMessage[]> ReplyLong(this IUserMessage msg, string content, string breakOn = "\n", string addToEnd = "", string addToStart = "") | ||||
|         { | ||||
|  | ||||
|             if (content.Length < 2000) return new[] { await msg.Channel.SendMessageAsync(content).ConfigureAwait(false) }; | ||||
|             var list = new List<IMessage>(); | ||||
|             var list = new List<IUserMessage>(); | ||||
|  | ||||
|             var temp = Regex.Split(content, breakOn).Select(x => x += breakOn).ToList(); | ||||
|             string toolong; | ||||
| @@ -77,7 +77,7 @@ namespace NadekoBot.Extensions | ||||
|             return list.ToArray(); | ||||
|         } | ||||
|  | ||||
|         public static Task<IMessage> SendTableAsync<T>(this IMessageChannel ch, string seed, IEnumerable<T> items, Func<T, string> howToPrint, int columns = 3) | ||||
|         public static Task<IUserMessage> SendTableAsync<T>(this IMessageChannel ch, string seed, IEnumerable<T> items, Func<T, string> howToPrint, int columns = 3) | ||||
|         { | ||||
|             var i = 0; | ||||
|             return ch.SendMessageAsync($@"{seed}```xl | ||||
| @@ -86,7 +86,7 @@ namespace NadekoBot.Extensions | ||||
| ```"); | ||||
|         } | ||||
|  | ||||
|         public static Task<IMessage> SendTableAsync<T>(this IMessageChannel ch, IEnumerable<T> items, Func<T, string> howToPrint, int columns = 3) | ||||
|         public static Task<IUserMessage> SendTableAsync<T>(this IMessageChannel ch, IEnumerable<T> items, Func<T, string> howToPrint, int columns = 3) | ||||
|         { | ||||
|             return ch.SendTableAsync("", items, howToPrint, columns); | ||||
|         } | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace NadekoBot.Modules.CustomReactions | ||||
|                         }else return rng.Next().ToString(); | ||||
|                         } }, | ||||
|                     {new Regex("%mention%"), (e,m) => NadekoBot.BotMention }, | ||||
|                     {new Regex("%user%"), (e,m) => imsg.Author.Mention }, | ||||
|                     {new Regex("%user%"), (e,m) => umsg.Author.Mention }, | ||||
|                     {new Regex("%target%"), (e,m) => args?.Trim() ?? "" }, | ||||
|  | ||||
|                  }; | ||||
|   | ||||
| @@ -119,10 +119,10 @@ namespace NadekoBot.Modules.Permissions.Classes | ||||
|                         case PermissionsHandler.PermissionBanType.RoleBanModule: | ||||
|                             msg = $"You do not have a **role** which permits you the usage of **{command.Category}** module."; | ||||
|                             break; | ||||
|                         case PermissionsHandler.PermissionBanTypimsg.AuthorBanCommand: | ||||
|                         case PermissionsHandler.PermissionBanTypumsg.AuthorBanCommand: | ||||
|                             msg = $"{user.Mention}, You have been banned from using **{command.Text}** command."; | ||||
|                             break; | ||||
|                         case PermissionsHandler.PermissionBanTypimsg.AuthorBanModule: | ||||
|                         case PermissionsHandler.PermissionBanTypumsg.AuthorBanModule: | ||||
|                             msg = $"{user.Mention}, You have been banned from using **{command.Category}** module."; | ||||
|                             break; | ||||
|                         default: | ||||
|   | ||||
| @@ -142,10 +142,10 @@ namespace NadekoBot.Modules.Permissions.Classes | ||||
|             //user | ||||
|             if (serverPerms.UserPermissions.TryGetValue(user.Id, out perm) && | ||||
|                 perm.Modules.TryGetValue(command.Category, out val) && val == false) | ||||
|                 return PermissionBanTypimsg.AuthorBanModule; | ||||
|                 return PermissionBanTypumsg.AuthorBanModule; | ||||
|             if (serverPerms.UserPermissions.TryGetValue(user.Id, out perm) && | ||||
|                 perm.Commands.TryGetValue(command.Text, out val) && val == false) | ||||
|                 return PermissionBanTypimsg.AuthorBanCommand; | ||||
|                 return PermissionBanTypumsg.AuthorBanCommand; | ||||
|  | ||||
|             return PermissionBanType.None; | ||||
|         } | ||||
|   | ||||
| @@ -224,7 +224,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|                     .Parameter("user", ParameterType.Unparsed) | ||||
|                     .Do(async e => | ||||
|                     { | ||||
|                         var user = imsg.Author; | ||||
|                         var user = umsg.Author; | ||||
|                         if (!string.IsNullOrWhiteSpace(user)) | ||||
|                             try | ||||
|                             { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user