Added ..qdel, stop crying now ;p
This commit is contained in:
parent
c7a83aa58a
commit
98d166e539
@ -2,6 +2,7 @@ using Discord;
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using NadekoBot.Classes.Conversations.Commands;
|
using NadekoBot.Classes.Conversations.Commands;
|
||||||
|
using NadekoBot.DataModels;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using NadekoBot.Modules.Permissions.Classes;
|
using NadekoBot.Modules.Permissions.Classes;
|
||||||
using NadekoBot.Properties;
|
using NadekoBot.Properties;
|
||||||
@ -73,6 +74,25 @@ namespace NadekoBot.Modules.Conversations
|
|||||||
else
|
else
|
||||||
await e.Channel.SendMessage("💢`No quote found.`").ConfigureAwait(false);
|
await e.Channel.SendMessage("💢`No quote found.`").ConfigureAwait(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand("..qdel")
|
||||||
|
.Description("Deletes all quotes with the specified keyword. You have to either be bot owner or the creator of the quote to delete it.\n**Usage**: `..qdel abc`")
|
||||||
|
.Parameter("quote", ParameterType.Required)
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
var text = e.GetArg("quote")?.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
|
return;
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
if (NadekoBot.IsOwner(e.User.Id))
|
||||||
|
Classes.DbHandler.Instance.DeleteWhere<UserQuote>(uq => uq.Keyword == text);
|
||||||
|
else
|
||||||
|
Classes.DbHandler.Instance.DeleteWhere<UserQuote>(uq => uq.Keyword == text && uq.UserName == e.User.Name);
|
||||||
|
}).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await e.Channel.SendMessage("`Done.`").ConfigureAwait(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
manager.CreateCommands(NadekoBot.BotMention, cgb =>
|
manager.CreateCommands(NadekoBot.BotMention, cgb =>
|
||||||
|
Loading…
Reference in New Issue
Block a user