Updated documentation

This commit is contained in:
2022-05-03 21:58:44 +03:00
parent f3d0ea426e
commit f5f1827540
26 changed files with 520 additions and 180 deletions

View File

@@ -11,19 +11,48 @@ using System.Collections.Generic;
namespace DiscordBot.Discord.Commands
{
/// <summary>
/// The help command
/// </summary>
internal class Help : DBCommand
{
/// <summary>
/// Command name
/// </summary>
public string Command => "help";
/// <summary>
/// Command Description
/// </summary>
public string Description => "This command allows you to check all loadded commands";
/// <summary>
/// Command usage
/// </summary>
public string Usage => "help";
/// <summary>
/// Check if the command can be used <inheritdoca DM <see cref="IChannel"/>/>
/// </summary>
public bool canUseDM => true;
/// <summary>
/// Check if the command can be used in a server
/// </summary>
public bool canUseServer => true;
/// <summary>
/// Check if the command require administrator to be executed
/// </summary>
public bool requireAdmin => false;
/// <summary>
/// The main body of the command
/// </summary>
/// <param name="context">The command context</param>
/// <param name="message">The command message</param>
/// <param name="client">The discord bot client</param>
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
List<string> args = Functions.GetArguments(message);

View File

@@ -14,26 +14,49 @@ using ds = Discord;
using PluginManager.Interfaces;
using PluginManager.Others.Permissions;
using PluginManager.Online;
using PluginManager.Others;
namespace DiscordBot.Discord.Commands
{
class Restart : DBCommand
internal class Restart : DBCommand
{
string DBCommand.Command => "restart";
/// <summary>
/// Command name
/// </summary>
public string Command => "restart";
string DBCommand.Description => "Restart the bot";
/// <summary>
/// Command Description
/// </summary>
public string Description => "Restart the bot";
string DBCommand.Usage => "restart [-option]";
/// <summary>
/// Command usage
/// </summary>
public string Usage => "restart [-p | -c | -args | -cmd] <args>";
bool DBCommand.canUseDM => false;
/// <summary>
/// Check if the command can be used <inheritdoca DM <see cref="IChannel"/>/>
/// </summary>
public bool canUseDM => false;
bool DBCommand.canUseServer => true;
/// <summary>
/// Check if the command can be used in a server
/// </summary>
public bool canUseServer => true;
bool DBCommand.requireAdmin => true;
void DBCommand.Execute(dsc.SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
/// <summary>
/// Check if the command require administrator to be executed
/// </summary>
public bool requireAdmin => false;
/// <summary>
/// The main body of the command
/// </summary>
/// <param name="context">The command context</param>
/// <param name="message">The command message</param>
/// <param name="client">The discord bot client</param>
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
public async void Execute(dsc.SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
if (!DiscordPermissions.hasPermission(message.Author as SocketGuildUser, ds.GuildPermission.Administrator)) return;
var args = Functions.GetArguments(message);
@@ -79,6 +102,9 @@ namespace DiscordBot.Discord.Commands
}
Environment.Exit(0);
break;
default:
await context.Channel.SendMessageAsync("Invalid argument. Use `help restart` to see the usage.");
break;
}

View File

@@ -17,16 +17,44 @@ namespace DiscordBot.Discord.Commands
{
class Settings : DBCommand
{
/// <summary>
/// Command name
/// </summary>
public string Command => "set";
/// <summary>
/// Command Description
/// </summary>
public string Description => "This command allows you change all settings. Use \"set help\" to show details";
/// <summary>
/// Command usage
/// </summary>
public string Usage => "set [keyword] [new Value]";
/// <summary>
/// Check if the command can be used <inheritdoca DM <see cref="IChannel"/>/>
/// </summary>
public bool canUseDM => true;
/// <summary>
/// Check if the command can be used in a server
/// </summary>
public bool canUseServer => true;
/// <summary>
/// Check if the command require administrator to be executed
/// </summary>
public bool requireAdmin => true;
/// <summary>
/// The main body of the command
/// </summary>
/// <param name="context">The command context</param>
/// <param name="message">The command message</param>
/// <param name="client">The discord bot client</param>
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
var channel = message.Channel;