Help command now in db, .showemojis added, permissions more optimal
This commit is contained in:
		@@ -23,6 +23,9 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                _log = LogManager.GetCurrentClassLogger();
 | 
			
		||||
                NadekoBot.Client.MessageReceived += (imsg) =>
 | 
			
		||||
                {
 | 
			
		||||
                    if (imsg.Author.IsBot)
 | 
			
		||||
                        return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
                    var msg = imsg as IUserMessage;
 | 
			
		||||
                    if (msg == null)
 | 
			
		||||
                        return Task.CompletedTask;
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
            private Task PotentialFlowerGeneration(IMessage imsg)
 | 
			
		||||
            {
 | 
			
		||||
                var msg = imsg as IUserMessage;
 | 
			
		||||
                if (msg == null || msg.IsAuthor())
 | 
			
		||||
                if (msg == null || msg.IsAuthor() || msg.Author.IsBot)
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
                var channel = imsg.Channel as ITextChannel;
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
        {
 | 
			
		||||
            // has to be a user message
 | 
			
		||||
            var msg = imsg as IUserMessage;
 | 
			
		||||
            if (msg == null)
 | 
			
		||||
            if (msg == null || msg.Author.IsBot)
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            // channel must be private
 | 
			
		||||
            IPrivateChannel ch;
 | 
			
		||||
 
 | 
			
		||||
@@ -101,6 +101,8 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
 | 
			
		||||
            private Task AnswerReceived(IMessage imsg)
 | 
			
		||||
            {
 | 
			
		||||
                if (imsg.Author.IsBot)
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
                var msg = imsg as IUserMessage;
 | 
			
		||||
                if (msg == null)
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
 
 | 
			
		||||
@@ -106,6 +106,8 @@ namespace NadekoBot.Modules.Games.Trivia
 | 
			
		||||
 | 
			
		||||
        private Task PotentialGuess(IMessage imsg)
 | 
			
		||||
        {
 | 
			
		||||
            if (imsg.Author.IsBot)
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            var umsg = imsg as IUserMessage;
 | 
			
		||||
            if (umsg == null)
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,31 +11,40 @@ using System.Text;
 | 
			
		||||
using Discord.WebSocket;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using NadekoBot.Services.Database;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Help
 | 
			
		||||
{
 | 
			
		||||
    [NadekoModule("Help", "-")]
 | 
			
		||||
    public partial class Help : DiscordModule
 | 
			
		||||
    {
 | 
			
		||||
        public string HelpString {
 | 
			
		||||
            get {
 | 
			
		||||
                var str = @"To add me to your server, use this link -> <https://discordapp.com/oauth2/authorize?client_id={0}&scope=bot&permissions=66186303>
 | 
			
		||||
You can use `{1}modules` command to see a list of all modules.
 | 
			
		||||
You can use `{1}commands ModuleName`
 | 
			
		||||
(for example `{1}commands Administration`) to see a list of all of the commands in that module.
 | 
			
		||||
For a specific command help, use `{1}h CommandName` (for example {1}h !!q)
 | 
			
		||||
        private static string helpString { get; }
 | 
			
		||||
        public static string HelpString => String.Format(helpString, NadekoBot.Credentials.ClientId, NadekoBot.ModulePrefixes[typeof(Help).Name]);
 | 
			
		||||
 | 
			
		||||
        public static string DMHelpString { get; }
 | 
			
		||||
 | 
			
		||||
**LIST OF COMMANDS CAN BE FOUND ON THIS LINK**
 | 
			
		||||
<https://github.com/Kwoth/NadekoBot/blob/master/commandlist.md>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Nadeko Support Server: https://discord.gg/0ehQwTK2RBjAxzEY";
 | 
			
		||||
                return String.Format(str, NadekoBot.Credentials.ClientId, NadekoBot.ModulePrefixes[typeof(Help).Name]);
 | 
			
		||||
        static Help()
 | 
			
		||||
        {
 | 
			
		||||
            using (var uow = DbHandler.UnitOfWork())
 | 
			
		||||
            {
 | 
			
		||||
                var config = uow.BotConfig.GetOrCreate();
 | 
			
		||||
                helpString = config.HelpString;
 | 
			
		||||
                DMHelpString = config.DMHelpString;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Help(ILocalization loc, CommandService cmds, ShardedDiscordClient client) : base(loc, cmds, client)
 | 
			
		||||
        {
 | 
			
		||||
            client.MessageReceived += async (msg) =>
 | 
			
		||||
            {
 | 
			
		||||
                if (msg.Author.IsBot)
 | 
			
		||||
                    return;
 | 
			
		||||
                if (msg.Channel is IPrivateChannel)
 | 
			
		||||
                {
 | 
			
		||||
                    await msg.Channel.SendMessageAsync(DMHelpString).ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [NadekoCommand, Usage, Description, Aliases]
 | 
			
		||||
@@ -44,6 +53,30 @@ Nadeko Support Server: https://discord.gg/0ehQwTK2RBjAxzEY";
 | 
			
		||||
 | 
			
		||||
            await umsg.Channel.SendMessageAsync("`List of modules:` ```xl\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);
 | 
			
		||||
 | 
			
		||||
            await RunWithTypingIntheBackgorund(async () =>
 | 
			
		||||
            {
 | 
			
		||||
                await Task.Delay(100000);
 | 
			
		||||
            }, umsg);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async Task RunWithTypingIntheBackgorund(Func<Task> someFUnc, IUserMessage ctx)
 | 
			
		||||
        {
 | 
			
		||||
            var cancelSource = new CancellationTokenSource();
 | 
			
		||||
            var cancelToken = cancelSource.Token;
 | 
			
		||||
            var t = Task.Run(async () => 
 | 
			
		||||
            {
 | 
			
		||||
                while (!cancelToken.IsCancellationRequested)
 | 
			
		||||
                {
 | 
			
		||||
                    await Task.Delay(10000);
 | 
			
		||||
                    await ctx.Channel.TriggerTypingAsync();
 | 
			
		||||
                }
 | 
			
		||||
            }, cancelToken);
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                await someFUnc();
 | 
			
		||||
            }
 | 
			
		||||
            finally { cancelSource.Cancel(); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [NadekoCommand, Usage, Description, Aliases]
 | 
			
		||||
 
 | 
			
		||||
@@ -176,8 +176,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = command.Text.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command on this server.").ConfigureAwait(false);
 | 
			
		||||
@@ -199,8 +198,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module on this server.").ConfigureAwait(false);
 | 
			
		||||
@@ -222,8 +220,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = command.Text.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command for `{user}` user.").ConfigureAwait(false);
 | 
			
		||||
@@ -245,8 +242,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module for `{user}` user.").ConfigureAwait(false);
 | 
			
		||||
@@ -268,8 +264,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = command.Text.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command for `{role}` role.").ConfigureAwait(false);
 | 
			
		||||
@@ -291,8 +286,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module for `{role}` role.").ConfigureAwait(false);
 | 
			
		||||
@@ -315,8 +309,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                        SecondaryTargetName = command.Text.ToLowerInvariant(),
 | 
			
		||||
                        State = action.Value,
 | 
			
		||||
                    };
 | 
			
		||||
                    uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                    uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                    uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                    await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -342,8 +335,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module for `{chnl}` channel.").ConfigureAwait(false);
 | 
			
		||||
@@ -365,8 +357,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = "*",
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` for `{chnl}` channel.").ConfigureAwait(false);
 | 
			
		||||
@@ -388,8 +379,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = "*",
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` for `{role}` role.").ConfigureAwait(false);
 | 
			
		||||
@@ -411,8 +401,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = "*",
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` for `{user}` user.").ConfigureAwait(false);
 | 
			
		||||
@@ -434,75 +423,10 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    SecondaryTargetName = "*",
 | 
			
		||||
                    State = action.Value,
 | 
			
		||||
                };
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Prepend(newPerm);
 | 
			
		||||
                uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission = newPerm;
 | 
			
		||||
                uow.GuildConfigs.SetNewRootPermission(channel.Guild.Id, newPerm);
 | 
			
		||||
                await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
            await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` on this server.").ConfigureAwait(false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //[LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias]
 | 
			
		||||
        //[RequireContext(ContextType.Guild)]
 | 
			
		||||
        //public async Task AllChnlCmds(IUserMessage imsg, Module module, PermissionAction action, ITextChannel chnl)
 | 
			
		||||
        //{
 | 
			
		||||
        //    var channel = (ITextChannel)imsg.Channel;
 | 
			
		||||
 | 
			
		||||
        //    using (var uow = DbHandler.UnitOfWork())
 | 
			
		||||
        //    {
 | 
			
		||||
        //        uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Add(new Permission
 | 
			
		||||
        //        {
 | 
			
		||||
        //            PrimaryTarget = PrimaryPermissionType.Channel,
 | 
			
		||||
        //            PrimaryTargetId = chnl.Id,
 | 
			
		||||
        //            SecondaryTarget = SecondaryPermissionType.AllCommands,
 | 
			
		||||
        //            SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
        //            State = action.Value,
 | 
			
		||||
        //        });
 | 
			
		||||
        //        await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
        //    }
 | 
			
		||||
        //    await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL COMMANDS` from `{module.Name}` module for `{chnl}` channel.").ConfigureAwait(false);
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //[LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias]
 | 
			
		||||
        //[RequireContext(ContextType.Guild)]
 | 
			
		||||
        //public async Task AllRoleCmds(IUserMessage imsg, Module module, PermissionAction action, IRole role)
 | 
			
		||||
        //{
 | 
			
		||||
        //    var channel = (ITextChannel)imsg.Channel;
 | 
			
		||||
 | 
			
		||||
        //    using (var uow = DbHandler.UnitOfWork())
 | 
			
		||||
        //    {
 | 
			
		||||
        //        uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Add(new Permission
 | 
			
		||||
        //        {
 | 
			
		||||
        //            PrimaryTarget = PrimaryPermissionType.Role,
 | 
			
		||||
        //            PrimaryTargetId = role.Id,
 | 
			
		||||
        //            SecondaryTarget = SecondaryPermissionType.AllCommands,
 | 
			
		||||
        //            SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
        //            State = action.Value,
 | 
			
		||||
        //        });
 | 
			
		||||
        //        await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
        //    }
 | 
			
		||||
        //    await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL COMMANDS` from `{module.Name}` module for `{role}` role.").ConfigureAwait(false);
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //[LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias]
 | 
			
		||||
        //[RequireContext(ContextType.Guild)]
 | 
			
		||||
        //public async Task AllUsrCmds(IUserMessage imsg, Module module, PermissionAction action, IUser user)
 | 
			
		||||
        //{
 | 
			
		||||
        //    var channel = (ITextChannel)imsg.Channel;
 | 
			
		||||
 | 
			
		||||
        //    using (var uow = DbHandler.UnitOfWork())
 | 
			
		||||
        //    {
 | 
			
		||||
        //        uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission.Add(new Permission
 | 
			
		||||
        //        {
 | 
			
		||||
        //            PrimaryTarget = PrimaryPermissionType.User,
 | 
			
		||||
        //            PrimaryTargetId = user.Id,
 | 
			
		||||
        //            SecondaryTarget = SecondaryPermissionType.AllCommands,
 | 
			
		||||
        //            SecondaryTargetName = module.Name.ToLowerInvariant(),
 | 
			
		||||
        //            State = action.Value,
 | 
			
		||||
        //        });
 | 
			
		||||
        //        await uow.CompleteAsync().ConfigureAwait(false);
 | 
			
		||||
        //    }
 | 
			
		||||
        //    await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL COMMANDS` from `{module.Name}` module for `{user}` user.").ConfigureAwait(false);
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -144,13 +144,26 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [NadekoCommand, Usage, Description, Aliases]
 | 
			
		||||
        [RequireContext(ContextType.Guild)]
 | 
			
		||||
        public async Task Stats(IUserMessage umsg)
 | 
			
		||||
        {
 | 
			
		||||
            var channel = (ITextChannel)umsg.Channel;
 | 
			
		||||
            var channel = umsg.Channel;
 | 
			
		||||
 | 
			
		||||
            await channel.SendMessageAsync(await NadekoBot.Stats.Print());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Regex emojiFinder { get; } = new Regex(@"<:(?<name>.+?):(?<id>\d*)>", RegexOptions.Compiled);
 | 
			
		||||
        [NadekoCommand, Usage, Description, Aliases]
 | 
			
		||||
        public async Task Showemojis(IUserMessage msg, [Remainder] string emojis)
 | 
			
		||||
        {
 | 
			
		||||
            var matches = emojiFinder.Matches(emojis);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            var result = string.Join("\n", matches.Cast<Match>()
 | 
			
		||||
                                                  .Select(m => $"`Name:` {m.Groups["name"]} `Link:` http://discordapp.com/api/emojis/{m.Groups["id"]}.png"));
 | 
			
		||||
            
 | 
			
		||||
            await msg.Channel.SendMessageAsync(result).ConfigureAwait(false);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3032
									
								
								src/NadekoBot/Resources/CommandStrings.Designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3032
									
								
								src/NadekoBot/Resources/CommandStrings.Designer.cs
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -2610,4 +2610,13 @@
 | 
			
		||||
  <data name="checkstream_cmd" xml:space="preserve">
 | 
			
		||||
    <value>checkstream cs</value>
 | 
			
		||||
  </data>
 | 
			
		||||
  <data name="showemojis_cmd" xml:space="preserve">
 | 
			
		||||
    <value>showemojis se</value>
 | 
			
		||||
  </data>
 | 
			
		||||
  <data name="showemojis_desc" xml:space="preserve">
 | 
			
		||||
    <value>Shows a name and a link to every special emoji in the message.</value>
 | 
			
		||||
  </data>
 | 
			
		||||
  <data name="showemojis_usage" xml:space="preserve">
 | 
			
		||||
    <value>`.se A message full of emojis`</value>
 | 
			
		||||
  </data>
 | 
			
		||||
</root>
 | 
			
		||||
@@ -34,8 +34,19 @@ namespace NadekoBot.Services.Database.Models
 | 
			
		||||
        public List<EightBallResponse> EightBallResponses { get; set; } = new List<EightBallResponse>();
 | 
			
		||||
        public List<RaceAnimal> RaceAnimals { get; set; } = new List<RaceAnimal>();
 | 
			
		||||
 | 
			
		||||
        public string DMHelpString { get; set; } 
 | 
			
		||||
        public string HelpString { get; set; }
 | 
			
		||||
        public string DMHelpString { get; set; } = "Type `-h` for help.";
 | 
			
		||||
        public string HelpString { get; set; } = @"To add me to your server, use this link -> <https://discordapp.com/oauth2/authorize?client_id={0}&scope=bot&permissions=66186303>
 | 
			
		||||
You can use `{1}modules` command to see a list of all modules.
 | 
			
		||||
You can use `{1}commands ModuleName`
 | 
			
		||||
(for example `{1}commands Administration`) to see a list of all of the commands in that module.
 | 
			
		||||
For a specific command help, use `{1}h CommandName` (for example {1}h !!q)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
**LIST OF COMMANDS CAN BE FOUND ON THIS LINK**
 | 
			
		||||
<https://github.com/Kwoth/NadekoBot/blob/master/commandlist.md>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Nadeko Support Server: https://discord.gg/0ehQwTK2RBjAxzEY";
 | 
			
		||||
 | 
			
		||||
        public int MigrationVersion { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ namespace NadekoBot.Services.Database.Repositories
 | 
			
		||||
    {
 | 
			
		||||
        GuildConfig For(ulong guildId);
 | 
			
		||||
        GuildConfig PermissionsFor(ulong guildId);
 | 
			
		||||
        void SetNewRootPermission(ulong guildId, Permission p);
 | 
			
		||||
        IEnumerable<FollowedStream> GetAllFollowedStreams();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Modules.Permissions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Services.Database.Repositories.Impl
 | 
			
		||||
{
 | 
			
		||||
@@ -88,5 +89,15 @@ namespace NadekoBot.Services.Database.Repositories.Impl
 | 
			
		||||
            _set.Include(gc => gc.FollowedStreams)
 | 
			
		||||
                .SelectMany(gc => gc.FollowedStreams)
 | 
			
		||||
                .ToList();
 | 
			
		||||
 | 
			
		||||
        public void SetNewRootPermission(ulong guildId, Permission p)
 | 
			
		||||
        {
 | 
			
		||||
            var data = _set
 | 
			
		||||
                        .Include(gc => gc.RootPermission)
 | 
			
		||||
                        .FirstOrDefault(gc => gc.GuildId == guildId);
 | 
			
		||||
 | 
			
		||||
            data.RootPermission.Prepend(p);
 | 
			
		||||
            data.RootPermission = p;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user