mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 10:18:27 -04:00
.btr and .sclr added, cleanup
This commit is contained in:
@@ -24,7 +24,7 @@ public partial class Searches
|
||||
return;
|
||||
}
|
||||
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithDescription(animeData.Synopsis.Replace("<br>",
|
||||
Environment.NewLine,
|
||||
@@ -56,7 +56,7 @@ public partial class Searches
|
||||
return;
|
||||
}
|
||||
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithDescription(mangaData.Synopsis.Replace("<br>",
|
||||
Environment.NewLine,
|
||||
|
@@ -35,7 +35,7 @@ public partial class Searches
|
||||
}
|
||||
|
||||
var symbol = symbols.First();
|
||||
var promptEmbed = _sender.CreateEmbed()
|
||||
var promptEmbed = CreateEmbed()
|
||||
.WithDescription(symbol.Description)
|
||||
.WithTitle(GetText(strs.did_you_mean(symbol.Symbol)));
|
||||
|
||||
@@ -67,7 +67,7 @@ public partial class Searches
|
||||
|
||||
var price = stock.Price.ToString("C2", localCulture);
|
||||
|
||||
var eb = _sender.CreateEmbed()
|
||||
var eb = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor(stock.Symbol)
|
||||
.WithUrl($"https://www.tradingview.com/chart/?symbol={stock.Symbol}")
|
||||
@@ -112,7 +112,7 @@ public partial class Searches
|
||||
|
||||
if (nearest is not null)
|
||||
{
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithTitle(GetText(strs.crypto_not_found))
|
||||
.WithDescription(
|
||||
GetText(strs.did_you_mean(Format.Bold($"{nearest.Name} ({nearest.Symbol})"))));
|
||||
@@ -145,7 +145,7 @@ public partial class Searches
|
||||
await using var sparkline = await _service.GetSparklineAsync(crypto.Id, usd.PercentChange7d >= 0);
|
||||
var fileName = $"{crypto.Slug}_7d.png";
|
||||
|
||||
var toSend = _sender.CreateEmbed()
|
||||
var toSend = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor($"#{crypto.CmcRank}")
|
||||
.WithTitle($"{crypto.Name} ({crypto.Symbol})")
|
||||
@@ -198,7 +198,7 @@ public partial class Searches
|
||||
.PageSize(10)
|
||||
.Page((items, _) =>
|
||||
{
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor();
|
||||
|
||||
if (items.Count > 0)
|
||||
|
@@ -123,7 +123,7 @@ public partial class Searches
|
||||
if (!feeds.Any())
|
||||
{
|
||||
await Response()
|
||||
.Embed(_sender.CreateEmbed().WithOkColor().WithDescription(GetText(strs.feed_no_feed)))
|
||||
.Embed(CreateEmbed().WithOkColor().WithDescription(GetText(strs.feed_no_feed)))
|
||||
.SendAsync();
|
||||
return;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public partial class Searches
|
||||
.CurrentPage(page)
|
||||
.Page((items, cur) =>
|
||||
{
|
||||
var embed = _sender.CreateEmbed().WithOkColor();
|
||||
var embed = CreateEmbed().WithOkColor();
|
||||
var i = 0;
|
||||
var fs = string.Join("\n",
|
||||
items.Select(x => $"`{(cur * 10) + ++i}.` <#{x.ChannelId}> {x.Url}"));
|
||||
|
@@ -44,7 +44,7 @@ public partial class Searches
|
||||
|
||||
|
||||
await Response()
|
||||
.Embed(_sender.CreateEmbed()
|
||||
.Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle($"osu! {smode} profile for {user}")
|
||||
.WithThumbnailUrl($"https://a.ppy.sh/{userId}")
|
||||
@@ -78,7 +78,7 @@ public partial class Searches
|
||||
return;
|
||||
}
|
||||
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle($"osu!Gatari {modeStr} profile for {user}")
|
||||
.WithThumbnailUrl($"https://a.gatari.pw/{userStats.Id}")
|
||||
@@ -113,7 +113,7 @@ public partial class Searches
|
||||
var plays = await _service.GetOsuPlay(user, mode);
|
||||
|
||||
|
||||
var eb = _sender.CreateEmbed().WithOkColor().WithTitle($"Top 5 plays for {user}");
|
||||
var eb = CreateEmbed().WithOkColor().WithTitle($"Top 5 plays for {user}");
|
||||
|
||||
foreach(var (title, desc) in plays)
|
||||
eb.AddField(title, desc);
|
||||
|
@@ -25,7 +25,7 @@ public partial class Searches
|
||||
if (kvp.Key.ToUpperInvariant() == pokemon.ToUpperInvariant())
|
||||
{
|
||||
var p = kvp.Value;
|
||||
await Response().Embed(_sender.CreateEmbed()
|
||||
await Response().Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle(kvp.Key.ToTitleCase())
|
||||
.WithDescription(p.BaseStats.ToString())
|
||||
@@ -55,7 +55,7 @@ public partial class Searches
|
||||
{
|
||||
if (kvp.Key.ToUpperInvariant() == ability)
|
||||
{
|
||||
await Response().Embed(_sender.CreateEmbed()
|
||||
await Response().Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle(kvp.Value.Name)
|
||||
.WithDescription(string.IsNullOrWhiteSpace(kvp.Value.Desc)
|
||||
|
@@ -22,7 +22,7 @@ public partial class Searches
|
||||
}
|
||||
|
||||
await Response()
|
||||
.Embed(_sender.CreateEmbed()
|
||||
.Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle($"{verse.BookName} {verse.Chapter}:{verse.Verse}")
|
||||
.WithDescription(verse.Text))
|
||||
@@ -48,7 +48,7 @@ public partial class Searches
|
||||
await using var audio = await http.GetStreamAsync(arabic.Audio);
|
||||
|
||||
await Response()
|
||||
.Embed(_sender.CreateEmbed()
|
||||
.Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.AddField("Arabic", arabic.Text)
|
||||
.AddField("English", english.Text)
|
||||
|
@@ -59,14 +59,14 @@ public partial class Searches
|
||||
|
||||
descStr = descStr.TrimTo(4096);
|
||||
|
||||
var embed = _sender.CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor(ctx.User)
|
||||
.WithTitle(query.TrimTo(64)!)
|
||||
.WithDescription(descStr)
|
||||
.WithFooter(
|
||||
GetText(strs.results_in(data.Info.TotalResults, data.Info.SearchTime)),
|
||||
"https://i.imgur.com/G46fm8J.png");
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor(ctx.User)
|
||||
.WithTitle(query.TrimTo(64)!)
|
||||
.WithDescription(descStr)
|
||||
.WithFooter(
|
||||
GetText(strs.results_in(data.Info.TotalResults, data.Info.SearchTime)),
|
||||
"https://i.imgur.com/G46fm8J.png");
|
||||
|
||||
await Response().Embed(embed).SendAsync();
|
||||
}
|
||||
@@ -93,13 +93,13 @@ public partial class Searches
|
||||
return;
|
||||
}
|
||||
|
||||
EmbedBuilder CreateEmbed(IImageSearchResultEntry entry)
|
||||
EmbedBuilder CreateImageEmbed(IImageSearchResultEntry entry)
|
||||
{
|
||||
return _sender.CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor(ctx.User)
|
||||
.WithTitle(query)
|
||||
.WithImageUrl(entry.Link);
|
||||
return CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor(ctx.User)
|
||||
.WithTitle(query)
|
||||
.WithImageUrl(entry.Link);
|
||||
}
|
||||
|
||||
await Response()
|
||||
@@ -112,10 +112,11 @@ public partial class Searches
|
||||
var item = items.FirstOrDefault();
|
||||
|
||||
if (item is null)
|
||||
return _sender.CreateEmbed()
|
||||
.WithDescription(GetText(strs.no_search_results));
|
||||
return CreateEmbed()
|
||||
.WithPendingColor()
|
||||
.WithDescription(GetText(strs.no_search_results));
|
||||
|
||||
var embed = CreateEmbed(item);
|
||||
var embed = CreateImageEmbed(item);
|
||||
|
||||
return embed;
|
||||
})
|
||||
@@ -184,7 +185,7 @@ public partial class Searches
|
||||
//
|
||||
// var descStr = string.Join("\n\n", desc);
|
||||
//
|
||||
// var embed = _sender.CreateEmbed()
|
||||
// var embed = CreateEmbed()
|
||||
// .WithAuthor(ctx.User.ToString(),
|
||||
// "https://upload.wikimedia.org/wikipedia/en/9/90/The_DuckDuckGo_Duck.png")
|
||||
// .WithDescription($"{GetText(strs.search_for)} **{query}**\n\n" + descStr)
|
||||
|
@@ -39,7 +39,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
|
||||
var embed = _sender.CreateEmbed();
|
||||
var embed = CreateEmbed();
|
||||
var data = await _service.GetWeatherDataAsync(query);
|
||||
|
||||
if (data is null)
|
||||
@@ -102,7 +102,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
return;
|
||||
}
|
||||
|
||||
var eb = _sender.CreateEmbed()
|
||||
var eb = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText(strs.time_new))
|
||||
.WithDescription(Format.Code(data.Time.ToString(Culture)))
|
||||
@@ -128,7 +128,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
await Response()
|
||||
.Embed(_sender.CreateEmbed()
|
||||
.Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle(movie.Title)
|
||||
.WithUrl($"https://www.imdb.com/title/{movie.ImdbId}/")
|
||||
@@ -161,7 +161,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
private Task InternalRandomImage(SearchesService.ImageTag tag)
|
||||
{
|
||||
var url = _service.GetRandomImageUrl(tag);
|
||||
return Response().Embed(_sender.CreateEmbed().WithOkColor().WithImageUrl(url)).SendAsync();
|
||||
return Response().Embed(CreateEmbed().WithOkColor().WithImageUrl(url)).SendAsync();
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
@@ -190,7 +190,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
await Response()
|
||||
.Embed(_sender.CreateEmbed()
|
||||
.Embed(CreateEmbed()
|
||||
.WithOkColor()
|
||||
.AddField(GetText(strs.original_url), $"<{query}>")
|
||||
.AddField(GetText(strs.short_url), $"<{shortLink}>"))
|
||||
@@ -213,7 +213,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
return;
|
||||
}
|
||||
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle(card.Name)
|
||||
.WithDescription(card.Description)
|
||||
@@ -246,7 +246,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
return;
|
||||
}
|
||||
|
||||
var embed = _sender.CreateEmbed().WithOkColor().WithImageUrl(card.Img);
|
||||
var embed = CreateEmbed().WithOkColor().WithImageUrl(card.Img);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(card.Flavor))
|
||||
embed.WithDescription(card.Flavor);
|
||||
@@ -280,7 +280,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
.Page((items, _) =>
|
||||
{
|
||||
var item = items[0];
|
||||
return _sender.CreateEmbed()
|
||||
return CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithUrl(item.Permalink)
|
||||
.WithTitle(item.Word)
|
||||
@@ -311,7 +311,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
.Page((items, _) =>
|
||||
{
|
||||
var model = items.First();
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithDescription(ctx.User.Mention)
|
||||
.AddField(GetText(strs.word), model.Word, true)
|
||||
.AddField(GetText(strs._class), model.WordType, true)
|
||||
@@ -374,7 +374,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
public async Task Color(params Color[] colors)
|
||||
public async Task Color(params Rgba32[] colors)
|
||||
{
|
||||
if (!colors.Any())
|
||||
return;
|
||||
@@ -403,7 +403,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
|
||||
await Response()
|
||||
.Embed(
|
||||
_sender.CreateEmbed()
|
||||
CreateEmbed()
|
||||
.WithOkColor()
|
||||
.AddField("Username", usr.ToString())
|
||||
.AddField("Avatar Url", avatarUrl)
|
||||
|
@@ -79,9 +79,9 @@ public partial class Searches
|
||||
.Page((elements, cur) =>
|
||||
{
|
||||
if (elements.Count == 0)
|
||||
return _sender.CreateEmbed().WithDescription(GetText(strs.streams_none)).WithErrorColor();
|
||||
return CreateEmbed().WithDescription(GetText(strs.streams_none)).WithErrorColor();
|
||||
|
||||
var eb = _sender.CreateEmbed().WithTitle(GetText(strs.streams_follow_title)).WithOkColor();
|
||||
var eb = CreateEmbed().WithTitle(GetText(strs.streams_follow_title)).WithOkColor();
|
||||
for (var index = 0; index < elements.Count; index++)
|
||||
{
|
||||
var elem = elements[index];
|
||||
|
@@ -491,7 +491,7 @@ public sealed class StreamNotificationService : INService, IReadyExecutor
|
||||
|
||||
public EmbedBuilder GetEmbed(ulong guildId, StreamData status, bool showViewers = true)
|
||||
{
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = _sender.CreateEmbed(guildId)
|
||||
.WithTitle(status.Name)
|
||||
.WithUrl(status.StreamUrl)
|
||||
.WithDescription(status.StreamUrl)
|
||||
|
@@ -135,7 +135,7 @@ public sealed partial class FlagTranslateService : IReadyExecutor, INService
|
||||
|
||||
var response = await _ts.Translate("", lang, msg.Content).ConfigureAwait(false);
|
||||
|
||||
await msg.ReplyAsync(embed: _sender.CreateEmbed()
|
||||
await msg.ReplyAsync(embed: _sender.CreateEmbed(tc.Guild?.Id)
|
||||
.WithOkColor()
|
||||
.WithFooter(user.ToString() ?? reaction.UserId.ToString(),
|
||||
user.RealAvatarUrl().ToString())
|
||||
|
@@ -67,7 +67,7 @@ public sealed class TranslateService : ITranslateService, IExecNoCommand, IReady
|
||||
|| msg.Content.Equals(output, StringComparison.InvariantCultureIgnoreCase))
|
||||
return;
|
||||
|
||||
var embed = _sender.CreateEmbed().WithOkColor();
|
||||
var embed = _sender.CreateEmbed(guild?.Id).WithOkColor();
|
||||
|
||||
if (autoDelete)
|
||||
{
|
||||
|
@@ -28,7 +28,7 @@ public partial class Searches
|
||||
await ctx.Channel.TriggerTypingAsync();
|
||||
var translation = await _service.Translate(fromLang, toLang, text);
|
||||
|
||||
var embed = _sender.CreateEmbed().WithOkColor().AddField(fromLang, text).AddField(toLang, translation);
|
||||
var embed = CreateEmbed().WithOkColor().AddField(fromLang, text).AddField(toLang, translation);
|
||||
|
||||
await Response().Embed(embed).SendAsync();
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public partial class Searches
|
||||
{
|
||||
var langs = _service.GetLanguages().ToList();
|
||||
|
||||
var eb = _sender.CreateEmbed()
|
||||
var eb = CreateEmbed()
|
||||
.WithTitle(GetText(strs.supported_languages))
|
||||
.WithOkColor();
|
||||
|
||||
|
@@ -25,7 +25,7 @@ public partial class Searches
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.GetStringAsync($"{XKCD_URL}/info.0.json");
|
||||
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithImageUrl(comic.ImageLink)
|
||||
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{XKCD_URL}/{comic.Num}")
|
||||
@@ -60,7 +60,7 @@ public partial class Searches
|
||||
var res = await http.GetStringAsync($"{XKCD_URL}/{num}/info.0.json");
|
||||
|
||||
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
|
||||
var embed = _sender.CreateEmbed()
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithImageUrl(comic.ImageLink)
|
||||
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{XKCD_URL}/{num}")
|
||||
|
@@ -5,47 +5,46 @@ using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers;
|
||||
|
||||
public sealed class YoutubeProvide : Provider
|
||||
{
|
||||
private readonly IGoogleApiService _api;
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
|
||||
public override FollowedStream.FType Platform
|
||||
=> FollowedStream.FType.Youtube;
|
||||
|
||||
public YoutubeProvide(IGoogleApiService api, IHttpClientFactory httpFactory)
|
||||
{
|
||||
_api = api;
|
||||
_httpFactory = httpFactory;
|
||||
}
|
||||
|
||||
public override async Task<bool> IsValidUrl(string url)
|
||||
{
|
||||
await Task.Yield();
|
||||
// todo implement
|
||||
return url.Contains("youtube.com");
|
||||
}
|
||||
|
||||
public override Task<StreamData?> GetStreamDataByUrlAsync(string url)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
public override Task<StreamData?> GetStreamDataAsync(string login)
|
||||
{
|
||||
var client = _httpFactory.CreateClient();
|
||||
|
||||
client.GetAsync()
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public override Task<IReadOnlyCollection<StreamData>> GetStreamDataAsync(List<string> usernames)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
// public sealed class YoutubeProvide : Provider
|
||||
// {
|
||||
// private readonly IGoogleApiService _api;
|
||||
// private readonly IHttpClientFactory _httpFactory;
|
||||
//
|
||||
// public override FollowedStream.FType Platform
|
||||
// => FollowedStream.FType.Youtube;
|
||||
//
|
||||
// public YoutubeProvide(IGoogleApiService api, IHttpClientFactory httpFactory)
|
||||
// {
|
||||
// _api = api;
|
||||
// _httpFactory = httpFactory;
|
||||
// }
|
||||
//
|
||||
// public override async Task<bool> IsValidUrl(string url)
|
||||
// {
|
||||
// await Task.Yield();
|
||||
// return url.Contains("youtube.com");
|
||||
// }
|
||||
//
|
||||
// public override Task<StreamData?> GetStreamDataByUrlAsync(string url)
|
||||
// {
|
||||
// return default;
|
||||
// }
|
||||
//
|
||||
// public override Task<StreamData?> GetStreamDataAsync(string login)
|
||||
// {
|
||||
// var client = _httpFactory.CreateClient();
|
||||
//
|
||||
// client.GetAsync()
|
||||
//
|
||||
// return default;
|
||||
// }
|
||||
//
|
||||
// public override Task<IReadOnlyCollection<StreamData>> GetStreamDataAsync(List<string> usernames)
|
||||
// {
|
||||
// return default;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
public sealed class TwitchHelixProvider : Provider
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
|
Reference in New Issue
Block a user