mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Bot will now 'try' to set status to invisible before going offline when '.die' command is used, but it doesn't seem to have (much/any) effect. .qsearch is more powerful
This commit is contained in:
@@ -335,6 +335,7 @@ public partial class Administration
|
||||
{
|
||||
try
|
||||
{
|
||||
await _client.SetStatusAsync(UserStatus.DoNotDisturb);
|
||||
await ReplyConfirmLocalizedAsync(strs.shutting_down);
|
||||
}
|
||||
catch
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable warnings
|
||||
using NadekoBot.Common.Yml;
|
||||
using NadekoBot.Db;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
@@ -134,30 +134,40 @@ public partial class Utility
|
||||
.WithFooter(
|
||||
GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})"))));
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task QuoteSearch(string keyword, [Leftover] string text)
|
||||
private async Task QuoteSearchinternalAsync(string? keyword, string textOrAuthor)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
|
||||
if (string.IsNullOrWhiteSpace(textOrAuthor))
|
||||
return;
|
||||
|
||||
keyword = keyword.ToUpperInvariant();
|
||||
keyword = keyword?.ToUpperInvariant();
|
||||
|
||||
Quote keywordquote;
|
||||
Quote quote;
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
keywordquote = await uow.Quotes.SearchQuoteKeywordTextAsync(ctx.Guild.Id, keyword, text);
|
||||
quote = await uow.Quotes.SearchQuoteKeywordTextAsync(ctx.Guild.Id, keyword, textOrAuthor);
|
||||
}
|
||||
|
||||
if (keywordquote is null)
|
||||
if (quote is null)
|
||||
return;
|
||||
|
||||
await ctx.Channel.SendMessageAsync($"`#{keywordquote.Id}` 💬 "
|
||||
+ keyword.ToLowerInvariant()
|
||||
await ctx.Channel.SendMessageAsync($"`#{quote.Id}` 💬 "
|
||||
+ quote.Keyword.ToLowerInvariant()
|
||||
+ ": "
|
||||
+ keywordquote.Text.SanitizeAllMentions());
|
||||
+ quote.Text.SanitizeAllMentions());
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public partial Task QuoteSearch(string textOrAuthor)
|
||||
=> QuoteSearchinternalAsync(null, textOrAuthor);
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public partial Task QuoteSearch(string keyword, [Leftover] string textOrAuthor)
|
||||
=> QuoteSearchinternalAsync(keyword, textOrAuthor);
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task QuoteId(int id)
|
||||
|
Reference in New Issue
Block a user