mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
Fixed around 140 wrong namings and other refactorings which were marked as warnings
This commit is contained in:
@@ -60,8 +60,8 @@ public class CryptoService : INService
|
||||
{
|
||||
try
|
||||
{
|
||||
using var _http = _httpFactory.CreateClient();
|
||||
var strData = await _http.GetStringAsync(
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var strData = await http.GetStringAsync(
|
||||
"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?"
|
||||
+ $"CMC_PRO_API_KEY={_creds.CoinmarketcapApiKey}"
|
||||
+ "&start=1"
|
||||
|
@@ -40,7 +40,7 @@ public class FeedsService : INService
|
||||
_client = client;
|
||||
_eb = eb;
|
||||
|
||||
var _ = Task.Run(TrackFeeds);
|
||||
_= Task.Run(TrackFeeds);
|
||||
}
|
||||
|
||||
public async Task<EmbedBuilder> TrackFeeds()
|
||||
|
@@ -477,7 +477,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
if (!await ValidateQuery(word))
|
||||
return;
|
||||
|
||||
using var _http = _httpFactory.CreateClient();
|
||||
using var http = _httpFactory.CreateClient();
|
||||
string res;
|
||||
try
|
||||
{
|
||||
@@ -485,7 +485,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
e =>
|
||||
{
|
||||
e.AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(12);
|
||||
return _http.GetStringAsync("https://api.pearson.com/v2/dictionaries/entries?headword="
|
||||
return http.GetStringAsync("https://api.pearson.com/v2/dictionaries/entries?headword="
|
||||
+ WebUtility.UrlEncode(word));
|
||||
});
|
||||
|
||||
|
@@ -430,8 +430,8 @@ public class SearchesService : INService
|
||||
{
|
||||
var redis = _cache.Redis;
|
||||
var db = redis.GetDatabase();
|
||||
const string STEAM_GAME_IDS_KEY = "steam_names_to_appid";
|
||||
var exists = await db.KeyExistsAsync(STEAM_GAME_IDS_KEY);
|
||||
const string steamGameIdsKey = "steam_names_to_appid";
|
||||
// var exists = await db.KeyExistsAsync(steamGameIdsKey);
|
||||
|
||||
// if we didn't get steam name to id map already, get it
|
||||
//if (!exists)
|
||||
@@ -448,7 +448,7 @@ public class SearchesService : INService
|
||||
// }
|
||||
//}
|
||||
|
||||
var gamesMap = await _cache.GetOrAddCachedDataAsync(STEAM_GAME_IDS_KEY,
|
||||
var gamesMap = await _cache.GetOrAddCachedDataAsync(steamGameIdsKey,
|
||||
async _ =>
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
|
@@ -8,7 +8,7 @@ public partial class Searches
|
||||
[Group]
|
||||
public partial class XkcdCommands : NadekoSubmodule
|
||||
{
|
||||
private const string _xkcdUrl = "https://xkcd.com";
|
||||
private const string XKCD_URL = "https://xkcd.com";
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
|
||||
public XkcdCommands(IHttpClientFactory factory)
|
||||
@@ -23,12 +23,12 @@ public partial class Searches
|
||||
try
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.GetStringAsync($"{_xkcdUrl}/info.0.json");
|
||||
var res = await http.GetStringAsync($"{XKCD_URL}/info.0.json");
|
||||
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
.WithImageUrl(comic.ImageLink)
|
||||
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{_xkcdUrl}/{comic.Num}")
|
||||
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{XKCD_URL}/{comic.Num}")
|
||||
.AddField(GetText(strs.comic_number), comic.Num.ToString(), true)
|
||||
.AddField(GetText(strs.date), $"{comic.Month}/{comic.Year}", true);
|
||||
var sent = await ctx.Channel.EmbedAsync(embed);
|
||||
@@ -57,13 +57,13 @@ public partial class Searches
|
||||
try
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.GetStringAsync($"{_xkcdUrl}/{num}/info.0.json");
|
||||
var res = await http.GetStringAsync($"{XKCD_URL}/{num}/info.0.json");
|
||||
|
||||
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
.WithImageUrl(comic.ImageLink)
|
||||
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{_xkcdUrl}/{num}")
|
||||
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{XKCD_URL}/{num}")
|
||||
.AddField(GetText(strs.comic_number), comic.Num.ToString(), true)
|
||||
.AddField(GetText(strs.date), $"{comic.Month}/{comic.Year}", true);
|
||||
|
||||
|
Reference in New Issue
Block a user