Update QuoteRepository.cs
This commit is contained in:
parent
1418297958
commit
f4870c4678
@ -1,4 +1,5 @@
|
|||||||
using NadekoBot.Services.Database.Models;
|
using NadekoBot.Services.Database.Models;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -26,9 +27,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl
|
|||||||
public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
|
public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
|
||||||
{
|
{
|
||||||
var rngk = new NadekoRandom();
|
var rngk = new NadekoRandom();
|
||||||
string lowertext = text.ToLowerInvariant();
|
return _set.Where(q => q.Text.IndexOf(text, StringComparison.OrdinalIgnoreCase) >=0 && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
|
||||||
string uppertext = text.ToUpperInvariant();
|
|
||||||
return _set.Where(q => (q.Text.Contains(text) | q.Text.Contains(lowertext) | q.Text.Contains(uppertext)) & (q.GuildId == guildId && q.Keyword == keyword)).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user