More minor restructuring and cleanup. Most modules and submodules should be properly grouped now

This commit is contained in:
Kwoth
2022-01-02 04:31:54 +01:00
parent 25f249ab5e
commit 6322e0e077
8 changed files with 12 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
namespace NadekoBot.Modules.CustomReactions; namespace NadekoBot.Modules.CustomReactions;
public partial class CustomReactions : NadekoModule<CustomReactionsService> public partial class NadekoExpressions : NadekoModule<CustomReactionsService>
{ {
public enum All public enum All
{ {
@@ -12,7 +12,7 @@ public partial class CustomReactions : NadekoModule<CustomReactionsService>
private readonly IBotCredentials _creds; private readonly IBotCredentials _creds;
private readonly IHttpClientFactory _clientFactory; private readonly IHttpClientFactory _clientFactory;
public CustomReactions(IBotCredentials creds, IHttpClientFactory clientFactory) public NadekoExpressions(IBotCredentials creds, IHttpClientFactory clientFactory)
{ {
_creds = creds; _creds = creds;
_clientFactory = clientFactory; _clientFactory = clientFactory;
@@ -25,7 +25,6 @@ public partial class CustomReactions : NadekoModule<CustomReactionsService>
[Cmd] [Cmd]
public async partial Task AddCustReact(string key, [Leftover] string message) public async partial Task AddCustReact(string key, [Leftover] string message)
{ {
var channel = ctx.Channel as ITextChannel;
if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key)) if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key))
return; return;
@@ -231,7 +230,6 @@ public partial class CustomReactions : NadekoModule<CustomReactionsService>
private async Task InternalCrEdit(kwum id, CustomReactionsService.CrField option) private async Task InternalCrEdit(kwum id, CustomReactionsService.CrField option)
{ {
var cr = _service.GetCustomReaction(ctx.Guild?.Id, id);
if (!AdminInGuildOrOwnerInDm()) if (!AdminInGuildOrOwnerInDm())
{ {
await ReplyErrorLocalizedAsync(strs.insuff_perms); await ReplyErrorLocalizedAsync(strs.insuff_perms);

View File

@@ -71,7 +71,7 @@ public class VoteRewardService : INService, IReadyExecutor
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, "Critical error loading top.gg vote rewards."); Log.Error(ex, "Critical error loading top.gg vote rewards");
} }
var discordsKey = _creds.Votes?.DiscordsKey; var discordsKey = _creds.Votes?.DiscordsKey;

View File

@@ -14,17 +14,17 @@ public partial class Searches
[Group] [Group]
public partial class PathOfExileCommands : NadekoSubmodule<SearchesService> public partial class PathOfExileCommands : NadekoSubmodule<SearchesService>
{ {
private const string _poeURL = "https://www.pathofexile.com/character-window/get-characters?accountName="; private const string POE_URL = "https://www.pathofexile.com/character-window/get-characters?accountName=";
private const string _ponURL = "http://poe.ninja/api/Data/GetCurrencyOverview?league="; private const string PON_URL = "http://poe.ninja/api/Data/GetCurrencyOverview?league=";
private const string _pogsURL = "http://pathofexile.gamepedia.com/api.php?action=opensearch&search="; private const string POGS_URL = "http://pathofexile.gamepedia.com/api.php?action=opensearch&search=";
private const string _pogURL = private const string POG_URL =
"https://pathofexile.gamepedia.com/api.php?action=browsebysubject&format=json&subject="; "https://pathofexile.gamepedia.com/api.php?action=browsebysubject&format=json&subject=";
private const string _pogiURL = private const string POGI_URL =
"https://pathofexile.gamepedia.com/api.php?action=query&prop=imageinfo&iiprop=url&format=json&titles=File:"; "https://pathofexile.gamepedia.com/api.php?action=query&prop=imageinfo&iiprop=url&format=json&titles=File:";
private const string _profileURL = "https://www.pathofexile.com/account/view-profile/"; private const string PROFILE_URL = "https://www.pathofexile.com/account/view-profile/";
private readonly IHttpClientFactory _httpFactory; private readonly IHttpClientFactory _httpFactory;
@@ -131,7 +131,7 @@ public partial class Searches
try try
{ {
using var http = _httpFactory.CreateClient(); using var http = _httpFactory.CreateClient();
var res = await http.GetStringAsync($"{_poeURL}{usr}"); var res = await http.GetStringAsync($"{POE_URL}{usr}");
characters = JsonConvert.DeserializeObject<List<Account>>(res); characters = JsonConvert.DeserializeObject<List<Account>>(res);
} }
catch catch
@@ -150,7 +150,7 @@ public partial class Searches
var embed = _eb.Create() var embed = _eb.Create()
.WithAuthor($"Characters on {usr}'s account", .WithAuthor($"Characters on {usr}'s account",
"https://web.poecdn.com/image/favicon/ogimage.png", "https://web.poecdn.com/image/favicon/ogimage.png",
$"{_profileURL}{usr}") $"{PROFILE_URL}{usr}")
.WithOkColor(); .WithOkColor();
var tempList = characters.Skip(curPage * 9).Take(9).ToList(); var tempList = characters.Skip(curPage * 9).Take(9).ToList();
@@ -237,7 +237,7 @@ public partial class Searches
try try
{ {
var res = $"{_ponURL}{leagueName}"; var res = $"{PON_URL}{leagueName}";
using var http = _httpFactory.CreateClient(); using var http = _httpFactory.CreateClient();
var obj = JObject.Parse(await http.GetStringAsync(res)); var obj = JObject.Parse(await http.GetStringAsync(res));