mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-01-19 17:12:17 +00:00
show math help when people are not very smart
This commit is contained in:
parent
27907c7ee1
commit
91258e549f
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using CompatBot.Commands.Attributes;
|
||||
using CompatBot.Utils;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using org.mariuszgromada.math.mxparser;
|
||||
@ -15,6 +14,19 @@ namespace CompatBot.Commands
|
||||
[GroupCommand, Priority(9)]
|
||||
public async Task Expression(CommandContext ctx, [RemainingText, Description("Math expression")] string expression)
|
||||
{
|
||||
if (string.IsNullOrEmpty(expression))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var helpCmd = ctx.CommandsNext.FindCommand("math help", out _);
|
||||
var helpCtx = ctx.CommandsNext.CreateContext(ctx.Message, ctx.Prefix, helpCmd);
|
||||
await helpCmd.ExecuteAsync(helpCtx).ConfigureAwait(false);
|
||||
}
|
||||
catch { }
|
||||
return;
|
||||
}
|
||||
|
||||
var result = @"Something went wrong ¯\\_(ツ)\_/¯" + "\nMath is hard, yo";
|
||||
try
|
||||
{
|
||||
@ -30,7 +42,7 @@ namespace CompatBot.Commands
|
||||
|
||||
[Command("help"), LimitedToSpamChannel, Cooldown(1, 5, CooldownBucketType.Channel)]
|
||||
[Description("General math expression help, or description of specific math word")]
|
||||
public Task Help(CommandContext ctx, string word = null)
|
||||
public Task Help(CommandContext ctx)
|
||||
{
|
||||
return ctx.RespondAsync("Help for all the features and built-in constants and functions could be found at <https://mathparser.org/mxparser-math-collection/>");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user