Merge branch 'dev' of https://github.com/Kwoth/NadekoBot into dev
This commit is contained in:
commit
aa6f700d0b
@ -1,4 +1,4 @@
|
||||
using Discord;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Extensions;
|
||||
@ -101,6 +101,42 @@ namespace NadekoBot.Modules.Utility
|
||||
keywordquote.Text.SanitizeMentions());
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteId(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
return;
|
||||
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
var qfromid = uow.Quotes.Get(id);
|
||||
CREmbed crembed;
|
||||
|
||||
if (qfromid == null)
|
||||
{
|
||||
await Context.Channel.SendErrorAsync(GetText("quotes_notfound"));
|
||||
}
|
||||
else if (CREmbed.TryParse(qfromid.Text, out crembed))
|
||||
{
|
||||
try
|
||||
{
|
||||
await Context.Channel.EmbedAsync(crembed.ToEmbed(), crembed.PlainText ?? "")
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Warn("Sending CREmbed failed");
|
||||
_log.Warn(ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
else { await Context.Channel.SendMessageAsync($"`#{qfromid.Id}` 🗯️ " + qfromid.Keyword.ToLowerInvariant() + ": " +
|
||||
qfromid.Text.SanitizeMentions()); }
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AddQuote(string keyword, [Remainder] string text)
|
||||
@ -131,7 +167,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
var isAdmin = ((IGuildUser) Context.Message.Author).GuildPermissions.Administrator;
|
||||
|
||||
var sucess = false;
|
||||
var success = false;
|
||||
string response;
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
@ -145,11 +181,11 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
uow.Quotes.Remove(q);
|
||||
await uow.CompleteAsync().ConfigureAwait(false);
|
||||
sucess = true;
|
||||
success = true;
|
||||
response = GetText("quote_deleted", id);
|
||||
}
|
||||
}
|
||||
if (sucess)
|
||||
if (success)
|
||||
await Context.Channel.SendConfirmAsync(response);
|
||||
else
|
||||
await Context.Channel.SendErrorAsync(response);
|
||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -5756,6 +5756,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar quoteid qid.
|
||||
/// </summary>
|
||||
public static string quoteid_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("quoteid_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Displays the quote with the specified ID number. Quote ID numbers can be found by typing `.liqu [num]` where `[num]` is a number of a page which contains 15 quotes..
|
||||
/// </summary>
|
||||
public static string quoteid_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("quoteid_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}qid 123456`.
|
||||
/// </summary>
|
||||
public static string quoteid_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("quoteid_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to race.
|
||||
/// </summary>
|
||||
|
@ -1151,6 +1151,15 @@
|
||||
</data>
|
||||
<data name="searchquote_usage" xml:space="preserve">
|
||||
<value>`{0}qsearch keyword text`</value>
|
||||
</data>
|
||||
<data name="quoteid_cmd" xml:space="preserve">
|
||||
<value>quoteid qid</value>
|
||||
</data>
|
||||
<data name="quoteid_desc" xml:space="preserve">
|
||||
<value>Displays the quote with the specified ID number. Quote ID numbers can be found by typing `.liqu [num]` where `[num]` is a number of a page which contains 15 quotes.</value>
|
||||
</data>
|
||||
<data name="quoteid_usage" xml:space="preserve">
|
||||
<value>`{0}qid 123456`</value>
|
||||
</data>
|
||||
<data name="deletequote_cmd" xml:space="preserve">
|
||||
<value>deletequote delq</value>
|
||||
|
@ -6506,6 +6506,15 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No quotes found matching the quote ID specified..
|
||||
/// </summary>
|
||||
public static string utility_quotes_notfound {
|
||||
get {
|
||||
return ResourceManager.GetString("utility_quotes_notfound", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No quotes found which you can remove..
|
||||
/// </summary>
|
||||
|
@ -2083,6 +2083,9 @@ Owner ID: {2}</value>
|
||||
</data>
|
||||
<data name="utility_quotes_page_none" xml:space="preserve">
|
||||
<value>No quotes on this page.</value>
|
||||
<data name="utility_quotes_notfound" xml:space="preserve">
|
||||
<value>No quotes found matching the quote ID specified.</value>
|
||||
</data>
|
||||
</data>
|
||||
<data name="utility_quotes_remove_none" xml:space="preserve">
|
||||
<value>No quotes found which you can remove.</value>
|
||||
|
Loading…
Reference in New Issue
Block a user