Added more embeds for responses

This commit is contained in:
Deukhoofd 2018-10-27 13:57:37 +02:00
parent c5b7fb1b83
commit a242f2756e
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 16 additions and 8 deletions

View File

@ -86,9 +86,12 @@ namespace DeukBot4.MessageHandlers.CommandHandler
case CommandRequest.RequestCode.UnknownCommand:
var permission = await PermissionValidator.GetUserPermissionLevel(message);
var similar = await GetSimilarCommand(req.CommandName, permission);
await message.Channel.SendMessageAsync(
$"Unknown command: ``{req.CommandName}``. Did you mean: ``{similar}``? " +
$"Alternatively, use ``{CommandTrigger}help`` for a list of all commands");
var response = $"Unknown command: ``{req.CommandName}``. Did you mean: ``{similar}``? " +
$"Alternatively, use ``{CommandTrigger}help`` for a list of all commands";
var embed = EmbedFactory.GetStandardEmbedBuilder();
embed.Title = "Unknown Command";
embed.Description = response;
await message.Channel.SendMessageAsync("", embed: embed.Build());
break;
default:
throw new ArgumentOutOfRangeException();

View File

@ -1,6 +1,7 @@
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using DeukBot4.MessageHandlers.CommandHandler;
using DeukBot4.Utilities;
using Discord.WebSocket;
@ -30,9 +31,12 @@ namespace DeukBot4.MessageHandlers
if (!timespan.HasValue)
return;
var embed = EmbedFactory.GetStandardEmbedBuilder();
embed.Title = "Reminder";
if (timespan.Value.TotalMinutes < 5)
{
message.Channel.SendMessageAsync("A reminder should be at least 5 minutes in the future");
embed.Description = "A reminder should be at least 5 minutes in the future";
message.Channel.SendMessageAsync("", embed: embed.Build());
return;
}
@ -41,11 +45,12 @@ namespace DeukBot4.MessageHandlers
recip = message.Author.Id;
}
Database.ReminderHandler.Main.AddReminder(timespan.Value, action, message.Channel.Id, message.Author.Id, recip);
message.Channel.SendMessageAsync(
message.Author.Id == recip
embed.Description = message.Author.Id.Equals(recip)
? $"Reminder set! I will remind you in {timespan.Value.ToPrettyFormat()} to {action}"
: $"Reminder set! I will remind <@!{recip}> in {timespan.Value.ToPrettyFormat()} to {action}");
: $"Reminder set! I will remind <@!{recip}> in {timespan.Value.ToPrettyFormat()} to {action}";
Database.ReminderHandler.Main.AddReminder(timespan.Value, action, message.Channel.Id, message.Author.Id, recip);
message.Channel.SendMessageAsync(embed: embed.Build());
}
private static Regex TimespanMatcher =