|
|
|
|
using Discord;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Kehyeedra3.Commands
|
|
|
|
|
{
|
|
|
|
|
[Group]
|
|
|
|
|
public class HelpModule : ModuleBase ///////////////////////////////////////////////
|
|
|
|
|
{
|
|
|
|
|
private CommandService _service;
|
|
|
|
|
|
|
|
|
|
public HelpModule(CommandService service) //Create a constructor for the commandservice dependency
|
|
|
|
|
{
|
|
|
|
|
_service = service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Command("help"), Summary("Shows this thing")]
|
|
|
|
|
public async Task HelpCommand([Remainder] string command = null)
|
|
|
|
|
{
|
|
|
|
|
if(command == null)
|
|
|
|
|
{
|
|
|
|
|
EmbedBuilder embed = new EmbedBuilder();
|
|
|
|
|
foreach (var module in Bot._cmds.Modules)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder coommands = new StringBuilder("");
|
|
|
|
|
foreach(var cmd in module.Commands)
|
|
|
|
|
{
|
|
|
|
|
var result = await cmd.CheckPreconditionsAsync(Context, Bot._dmap).ConfigureAwait(false);
|
|
|
|
|
if (result.IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
coommands.Append(cmd.Name);
|
|
|
|
|
|
|
|
|
|
if (cmd != module.Commands.LastOrDefault()) coommands.Append(", ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
embed.AddField(module.Name, coommands.ToString());
|
|
|
|
|
}
|
|
|
|
|
await ReplyAsync("Here's a list of commands, search for a command to find what it be and what it do", false, embed.Build());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var res = Bot._cmds.Search(command);
|
|
|
|
|
if (res.IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
EmbedBuilder embed = new EmbedBuilder();
|
|
|
|
|
|
|
|
|
|
var coomand = res.Commands.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
embed.AddField(coomand.Command.Name ?? "N/A", string.IsNullOrEmpty(coomand.Command.Summary) ? "No Summary Found" : coomand.Command.Summary);
|
|
|
|
|
|
|
|
|
|
await ReplyAsync($"Here's a command like **{command}**", false, embed.Build());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await ReplyAsync("Check your input retard");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[Command("serverinv"), Summary("Invite to bot server (mainly used for assets)")]
|
|
|
|
|
public async Task BotServerInvite()
|
|
|
|
|
{
|
|
|
|
|
await Context.Channel.SendMessageAsync("discord.gg/DAW53N9");
|
|
|
|
|
}
|
|
|
|
|
[Command("botinv"), Summary("Post the bot invite link")]
|
|
|
|
|
public async Task BotInvite()
|
|
|
|
|
{
|
|
|
|
|
await Context.Channel.SendMessageAsync("Main bot: https://discordapp.com/api/oauth2/authorize?client_id=303457448168128519&scope=bot&permissions=0 \n" +
|
|
|
|
|
"Test bot: https://discordapp.com/api/oauth2/authorize?client_id=319942676319436810&scope=bot&permissions=0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|