Beispiel #1
0
        public async Task Module([Remainder] string name)
        {
            ModuleInfo module = services.GetModules().First(n => (n.Name.ToLower() == name.ToLower()));

            if (module != null)
            {
                EmbedBuilder       embed  = new EmbedBuilder();
                EmbedFooterBuilder footer = new EmbedFooterBuilder();

                //Make the footer the current UTC time
                footer.WithText(DateTime.UtcNow.ToString() + " UTC");
                embed.WithFooter(footer);
                embed.WithColor(new Color(0x4900ff));

                //Make the title the modules name + some info.
                embed.Title = $"Module {module.Name}'s commands. Contains {module.Commands.Count} out of 25 max commands.";

                //Add each command in the module into its own field.
                foreach (var cmd in module.Commands)
                {
                    embed.AddField(y =>
                    {
                        y.Name     = cmd.Name;
                        y.Value    = cmd.Summary;
                        y.IsInline = false;
                    });
                }

                await ReplyAsync("", embed : embed);
            }
            else
            {
                //The module was an invalid name, tell the user
                IUserMessage msg = await ReplyAsync("A module with the name '" + name + "' does not exist.");

                msg.DeleteAfterSeconds(20);
            }
        }
        async Task UnmuteUser(IUser user, bool fromMute = false)
        {
            var u = user as IGuildUser;

            if (!fromMute && u == Context.Message.Author)
            {
                await ReplyAsync("You can't unmute yourself.").DeleteAfterSeconds(30);

                return;
            }

            if (!fromMute && Context != null && Context.Message != null)
            {
                await Context.Message.DeleteAsync();
            }

            MutedUsers.Remove(user.Id);
            await u.RemoveRoleAsync(Context.Guild.GetRole(_settings.MutedRoleId));

            IUserMessage reply = await ReplyAsync("User " + user + " has been unmuted.");

            // await Task.Delay(TimeSpan.FromSeconds(10d));
            reply?.DeleteAfterSeconds(10d);
        }