mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
- Removed NadekoCommand and Aliases attribute from all commands
- All commands must be marked as partial - Added [Cmd] Attribute to all commands - Cmd Attribute comes from the source generator which adds [NadekoCommand] and [Aliases] Attribute to each command - Should be updated in the future probably to be more performant and maybe add extra data to the commands - Started reorganizing modules and submodules
This commit is contained in:
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService>
|
||||
public partial class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService>
|
||||
{
|
||||
// [NadekoCommand, Aliases]
|
||||
// public async Task Novel([Leftover] string query)
|
||||
@@ -38,8 +38,7 @@ public partial class Searches
|
||||
// await ctx.Channel.EmbedAsync(embed);
|
||||
// }
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[NadekoCommand, Aliases]
|
||||
[Priority(0)]
|
||||
public async Task Mal([Leftover] string name)
|
||||
{
|
||||
@@ -130,16 +129,14 @@ public partial class Searches
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task Mal(IGuildUser usr)
|
||||
public partial Task Mal(IGuildUser usr)
|
||||
=> Mal(usr.Username);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Anime([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Anime([Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
@@ -169,10 +166,9 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Manga([Leftover] string query)
|
||||
public async partial Task Manga([Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
|
@@ -5,11 +5,10 @@ namespace NadekoBot.Modules.Searches;
|
||||
|
||||
public partial class Searches
|
||||
{
|
||||
public class CryptoCommands : NadekoSubmodule<CryptoService>
|
||||
public partial class CryptoCommands : NadekoSubmodule<CryptoService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Crypto(string name)
|
||||
[Cmd]
|
||||
public async partial Task Crypto(string name)
|
||||
{
|
||||
name = name?.ToUpperInvariant();
|
||||
|
||||
|
@@ -8,16 +8,15 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class FeedCommands : NadekoSubmodule<FeedsService>
|
||||
public partial class FeedCommands : NadekoSubmodule<FeedsService>
|
||||
{
|
||||
private static readonly Regex YtChannelRegex =
|
||||
new(@"youtube\.com\/(?:c\/|channel\/|user\/)?(?<channelid>[a-zA-Z0-9\-]{1,})");
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null)
|
||||
public partial Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null)
|
||||
{
|
||||
var m = YtChannelRegex.Match(url);
|
||||
if (!m.Success) return ReplyErrorLocalizedAsync(strs.invalid_input);
|
||||
@@ -27,11 +26,10 @@ public partial class Searches
|
||||
return Feed("https://www.youtube.com/feeds/videos.xml?channel_id=" + channelId, channel);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task Feed(string url, [Leftover] ITextChannel channel = null)
|
||||
public async partial Task Feed(string url, [Leftover] ITextChannel channel = null)
|
||||
{
|
||||
var success = Uri.TryCreate(url, UriKind.Absolute, out var uri)
|
||||
&& (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps);
|
||||
@@ -62,11 +60,10 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.feed_not_valid);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task FeedRemove(int index)
|
||||
public async partial Task FeedRemove(int index)
|
||||
{
|
||||
if (_service.RemoveFeed(ctx.Guild.Id, --index))
|
||||
await ReplyConfirmLocalizedAsync(strs.feed_removed);
|
||||
@@ -74,11 +71,10 @@ public partial class Searches
|
||||
await ReplyErrorLocalizedAsync(strs.feed_out_of_range);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task FeedList()
|
||||
public async partial Task FeedList()
|
||||
{
|
||||
var feeds = _service.GetFeeds(ctx.Guild.Id);
|
||||
|
||||
|
@@ -6,29 +6,25 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class JokeCommands : NadekoSubmodule<SearchesService>
|
||||
public partial class JokeCommands : NadekoSubmodule<SearchesService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Yomama()
|
||||
[Cmd]
|
||||
public async partial Task Yomama()
|
||||
=> await SendConfirmAsync(await _service.GetYomamaJoke());
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Randjoke()
|
||||
[Cmd]
|
||||
public async partial Task Randjoke()
|
||||
{
|
||||
var (setup, punchline) = await _service.GetRandomJoke();
|
||||
await SendConfirmAsync(setup, punchline);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ChuckNorris()
|
||||
[Cmd]
|
||||
public async partial Task ChuckNorris()
|
||||
=> await SendConfirmAsync(await _service.GetChuckNorrisJoke());
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task WowJoke()
|
||||
[Cmd]
|
||||
public async partial Task WowJoke()
|
||||
{
|
||||
if (!_service.WowJokes.Any())
|
||||
{
|
||||
@@ -40,9 +36,8 @@ public partial class Searches
|
||||
await SendConfirmAsync(joke.Question, joke.Answer);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task MagicItem()
|
||||
[Cmd]
|
||||
public async partial Task MagicItem()
|
||||
{
|
||||
if (!_service.WowJokes.Any())
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class MemegenCommands : NadekoSubmodule
|
||||
public partial class MemegenCommands : NadekoSubmodule
|
||||
{
|
||||
private static readonly ImmutableDictionary<char, string> _map = new Dictionary<char, string>
|
||||
{
|
||||
@@ -27,9 +27,8 @@ public partial class Searches
|
||||
public MemegenCommands(IHttpClientFactory factory)
|
||||
=> _httpFactory = factory;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Memelist(int page = 1)
|
||||
[Cmd]
|
||||
public async partial Task Memelist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -55,9 +54,8 @@ public partial class Searches
|
||||
15);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Memegen(string meme, [Leftover] string memeText = null)
|
||||
[Cmd]
|
||||
public async partial Task Memegen(string meme, [Leftover] string memeText = null)
|
||||
{
|
||||
var memeUrl = $"http://api.memegen.link/{meme}";
|
||||
if (!string.IsNullOrWhiteSpace(memeText))
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class OsuCommands : NadekoSubmodule
|
||||
public partial class OsuCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly IBotCredentials _creds;
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
@@ -18,9 +18,8 @@ public partial class Searches
|
||||
_httpFactory = factory;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Osu(string user, [Leftover] string mode = null)
|
||||
[Cmd]
|
||||
public async partial Task Osu(string user, [Leftover] string mode = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(user))
|
||||
return;
|
||||
@@ -75,9 +74,8 @@ public partial class Searches
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Gatari(string user, [Leftover] string mode = null)
|
||||
[Cmd]
|
||||
public async partial Task Gatari(string user, [Leftover] string mode = null)
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var modeNumber = string.IsNullOrWhiteSpace(mode) ? 0 : ResolveGameMode(mode);
|
||||
@@ -114,9 +112,8 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Osu5(string user, [Leftover] string mode = null)
|
||||
[Cmd]
|
||||
public async partial Task Osu5(string user, [Leftover] string mode = null)
|
||||
{
|
||||
;
|
||||
if (string.IsNullOrWhiteSpace(_creds.OsuApiKey))
|
||||
|
@@ -12,7 +12,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public 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 _ponURL = "http://poe.ninja/api/Data/GetCurrencyOverview?league=";
|
||||
@@ -114,9 +114,8 @@ public partial class Searches
|
||||
public PathOfExileCommands(IHttpClientFactory httpFactory)
|
||||
=> _httpFactory = httpFactory;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PathOfExile(string usr, string league = "", int page = 1)
|
||||
[Cmd]
|
||||
public async partial Task PathOfExile(string usr, string league = "", int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -177,9 +176,8 @@ public partial class Searches
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PathOfExileLeagues()
|
||||
[Cmd]
|
||||
public async partial Task PathOfExileLeagues()
|
||||
{
|
||||
var leagues = new List<Leagues>();
|
||||
|
||||
@@ -219,9 +217,8 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PathOfExileCurrency(string leagueName, string currencyName, string convertName = "Chaos Orb")
|
||||
[Cmd]
|
||||
public async partial Task PathOfExileCurrency(string leagueName, string currencyName, string convertName = "Chaos Orb")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(leagueName))
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class PlaceCommands : NadekoSubmodule
|
||||
public partial class PlaceCommands : NadekoSubmodule
|
||||
{
|
||||
public enum PlaceType
|
||||
{
|
||||
@@ -20,14 +20,12 @@ public partial class Searches
|
||||
|
||||
private static readonly string _typesStr = string.Join(", ", Enum.GetNames(typeof(PlaceType)));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Placelist()
|
||||
[Cmd]
|
||||
public async partial Task Placelist()
|
||||
=> await SendConfirmAsync(GetText(strs.list_of_place_tags(Prefix)), _typesStr);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Place(PlaceType placeType, uint width = 0, uint height = 0)
|
||||
[Cmd]
|
||||
public async partial Task Place(PlaceType placeType, uint width = 0, uint height = 0)
|
||||
{
|
||||
var url = string.Empty;
|
||||
switch (placeType)
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class PokemonSearchCommands : NadekoSubmodule<SearchesService>
|
||||
public partial class PokemonSearchCommands : NadekoSubmodule<SearchesService>
|
||||
{
|
||||
public IReadOnlyDictionary<string, SearchPokemon> Pokemons
|
||||
=> _cache.LocalData.Pokemons;
|
||||
@@ -20,9 +20,8 @@ public partial class Searches
|
||||
public PokemonSearchCommands(IDataCache cache)
|
||||
=> _cache = cache;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Pokemon([Leftover] string pokemon = null)
|
||||
[Cmd]
|
||||
public async partial Task Pokemon([Leftover] string pokemon = null)
|
||||
{
|
||||
pokemon = pokemon?.Trim().ToUpperInvariant();
|
||||
if (string.IsNullOrWhiteSpace(pokemon))
|
||||
@@ -51,9 +50,8 @@ public partial class Searches
|
||||
await ReplyErrorLocalizedAsync(strs.pokemon_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PokemonAbility([Leftover] string ability = null)
|
||||
[Cmd]
|
||||
public async partial Task PokemonAbility([Leftover] string ability = null)
|
||||
{
|
||||
ability = ability?.Trim().ToUpperInvariant().Replace(" ", "", StringComparison.InvariantCulture);
|
||||
if (string.IsNullOrWhiteSpace(ability))
|
||||
|
@@ -40,9 +40,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
_tzSvc = tzSvc;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Rip([Leftover] IGuildUser usr)
|
||||
[Cmd]
|
||||
public async partial Task Rip([Leftover] IGuildUser usr)
|
||||
{
|
||||
var av = usr.RealAvatarUrl();
|
||||
if (av is null)
|
||||
@@ -53,9 +52,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
$"Rip {Format.Bold(usr.ToString())} \n\t- " + Format.Italics(ctx.User.ToString()));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Weather([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Weather([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -104,9 +102,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Time([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Time([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -153,9 +150,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync(embed: eb.Build());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Youtube([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Youtube([Leftover] string query = null)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -170,9 +166,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync(result);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Movie([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Movie([Leftover] string query = null)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -197,24 +192,20 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
.WithImageUrl(movie.Poster));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomCat()
|
||||
[Cmd]
|
||||
public partial Task RandomCat()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Cats);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomDog()
|
||||
[Cmd]
|
||||
public partial Task RandomDog()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Dogs);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomFood()
|
||||
[Cmd]
|
||||
public partial Task RandomFood()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Food);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomBird()
|
||||
[Cmd]
|
||||
public partial Task RandomBird()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Birds);
|
||||
|
||||
private Task InternalRandomImage(SearchesService.ImageTag tag)
|
||||
@@ -223,9 +214,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
return ctx.Channel.EmbedAsync(_eb.Create().WithOkColor().WithImageUrl(url));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Image([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Image([Leftover] string query = null)
|
||||
{
|
||||
var oterms = query?.Trim();
|
||||
if (!await ValidateQuery(query))
|
||||
@@ -277,9 +267,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Lmgtfy([Leftover] string ffs = null)
|
||||
[Cmd]
|
||||
public async partial Task Lmgtfy([Leftover] string ffs = null)
|
||||
{
|
||||
if (!await ValidateQuery(ffs))
|
||||
return;
|
||||
@@ -288,9 +277,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await SendConfirmAsync($"<{shortenedUrl}>");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Shorten([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Shorten([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -327,9 +315,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
.AddField(GetText(strs.short_url), $"<{shortLink}>"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Google([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Google([Leftover] string query = null)
|
||||
{
|
||||
query = query?.Trim();
|
||||
if (!await ValidateQuery(query))
|
||||
@@ -360,9 +347,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task DuckDuckGo([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task DuckDuckGo([Leftover] string query = null)
|
||||
{
|
||||
query = query?.Trim();
|
||||
if (!await ValidateQuery(query))
|
||||
@@ -392,9 +378,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task MagicTheGathering([Leftover] string search)
|
||||
[Cmd]
|
||||
public async partial Task MagicTheGathering([Leftover] string search)
|
||||
{
|
||||
if (!await ValidateQuery(search))
|
||||
return;
|
||||
@@ -420,9 +405,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Hearthstone([Leftover] string name)
|
||||
[Cmd]
|
||||
public async partial Task Hearthstone([Leftover] string name)
|
||||
{
|
||||
var arg = name;
|
||||
if (!await ValidateQuery(name))
|
||||
@@ -451,9 +435,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task UrbanDict([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task UrbanDict([Leftover] string query = null)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -491,9 +474,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ReplyErrorLocalizedAsync(strs.ud_error);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Define([Leftover] string word)
|
||||
[Cmd]
|
||||
public async partial Task Define([Leftover] string word)
|
||||
{
|
||||
if (!await ValidateQuery(word))
|
||||
return;
|
||||
@@ -562,9 +544,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Catfact()
|
||||
[Cmd]
|
||||
public async partial Task Catfact()
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var response = await http.GetStringAsync("https://catfact.ninja/fact");
|
||||
@@ -576,10 +557,9 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
//done in 3.0
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Revav([Leftover] IGuildUser usr = null)
|
||||
public async partial Task Revav([Leftover] IGuildUser usr = null)
|
||||
{
|
||||
if (usr is null)
|
||||
usr = (IGuildUser)ctx.User;
|
||||
@@ -592,9 +572,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
//done in 3.0
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Revimg([Leftover] string imageLink = null)
|
||||
[Cmd]
|
||||
public async partial Task Revimg([Leftover] string imageLink = null)
|
||||
{
|
||||
imageLink = imageLink?.Trim() ?? "";
|
||||
|
||||
@@ -603,9 +582,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await SendConfirmAsync($"https://images.google.com/searchbyimage?image_url={imageLink}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Wiki([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Wiki([Leftover] string query = null)
|
||||
{
|
||||
query = query?.Trim();
|
||||
|
||||
@@ -623,9 +601,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync(data.Query.Pages[0].FullUrl);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Color(params Color[] colors)
|
||||
[Cmd]
|
||||
public async partial Task Color(params Color[] colors)
|
||||
{
|
||||
if (!colors.Any())
|
||||
return;
|
||||
@@ -643,10 +620,9 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendFileAsync(ms, "colors.png");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Avatar([Leftover] IGuildUser usr = null)
|
||||
public async partial Task Avatar([Leftover] IGuildUser usr = null)
|
||||
{
|
||||
if (usr is null)
|
||||
usr = (IGuildUser)ctx.User;
|
||||
@@ -668,9 +644,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
ctx.User.Mention);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Wikia(string target, [Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Wikia(string target, [Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(target) || string.IsNullOrWhiteSpace(query))
|
||||
{
|
||||
@@ -709,10 +684,9 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Bible(string book, string chapterAndVerse)
|
||||
public async partial Task Bible(string book, string chapterAndVerse)
|
||||
{
|
||||
var obj = new BibleVerses();
|
||||
try
|
||||
@@ -740,9 +714,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Steam([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Steam([Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
@@ -769,7 +742,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync($"https://store.steampowered.com/app/{appId}");
|
||||
}
|
||||
|
||||
public async Task<bool> ValidateQuery(string query)
|
||||
private async Task<bool> ValidateQuery(string query)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(query)) return true;
|
||||
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class StreamNotificationCommands : NadekoSubmodule<StreamNotificationService>
|
||||
public partial class StreamNotificationCommands : NadekoSubmodule<StreamNotificationService>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
|
||||
@@ -19,11 +19,10 @@ public partial class Searches
|
||||
// private static readonly Regex picartoRegex = new Regex(@"picarto.tv/(?<name>.+[^/])/?",
|
||||
// RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamAdd(string link)
|
||||
public async partial Task StreamAdd(string link)
|
||||
{
|
||||
var data = await _service.FollowStream(ctx.Guild.Id, ctx.Channel.Id, link);
|
||||
if (data is null)
|
||||
@@ -36,12 +35,11 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed, GetText(strs.stream_tracked));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task StreamRemove(int index)
|
||||
public async partial Task StreamRemove(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -56,20 +54,18 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_removed(Format.Bold(fs.Username), fs.Type));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task StreamsClear()
|
||||
public async partial Task StreamsClear()
|
||||
{
|
||||
var count = _service.ClearAllStreams(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.streams_cleared);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamList(int page = 1)
|
||||
public async partial Task StreamList(int page = 1)
|
||||
{
|
||||
if (page-- < 1) return;
|
||||
|
||||
@@ -113,11 +109,10 @@ public partial class Searches
|
||||
12);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamOffline()
|
||||
public async partial Task StreamOffline()
|
||||
{
|
||||
var newValue = _service.ToggleStreamOffline(ctx.Guild.Id);
|
||||
if (newValue)
|
||||
@@ -126,11 +121,10 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_off_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamMessage(int index, [Leftover] string message)
|
||||
public async partial Task StreamMessage(int index, [Leftover] string message)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -147,11 +141,10 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_message_set(Format.Bold(fs.Username)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamMessageAll([Leftover] string message)
|
||||
public async partial Task StreamMessageAll([Leftover] string message)
|
||||
{
|
||||
var count = _service.SetStreamMessageForAll(ctx.Guild.Id, message);
|
||||
|
||||
@@ -164,10 +157,9 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_message_set_all(count));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamCheck(string url)
|
||||
public async partial Task StreamCheck(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class TranslateCommands : NadekoSubmodule<ITranslateService>
|
||||
public partial class TranslateCommands : NadekoSubmodule<ITranslateService>
|
||||
{
|
||||
public enum AutoDeleteAutoTranslate
|
||||
{
|
||||
@@ -12,9 +12,8 @@ public partial class Searches
|
||||
Nodel
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Translate(string from, string to, [Leftover] string text = null)
|
||||
[Cmd]
|
||||
public async partial Task Translate(string from, string to, [Leftover] string text = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -31,13 +30,12 @@ public partial class Searches
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(ChannelPerm.ManageMessages)]
|
||||
[OwnerOnly]
|
||||
public async Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
|
||||
public async partial Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
|
||||
{
|
||||
var toggle =
|
||||
await _service.ToggleAtl(ctx.Guild.Id, ctx.Channel.Id, autoDelete == AutoDeleteAutoTranslate.Del);
|
||||
@@ -47,19 +45,17 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.atl_stopped);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AutoTransLang()
|
||||
public async partial Task AutoTransLang()
|
||||
{
|
||||
if (await _service.UnregisterUser(ctx.Channel.Id, ctx.User.Id))
|
||||
await ReplyConfirmLocalizedAsync(strs.atl_removed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AutoTransLang(string from, string to)
|
||||
public async partial Task AutoTransLang(string from, string to)
|
||||
{
|
||||
var succ = await _service.RegisterUserAsync(ctx.User.Id, ctx.Channel.Id, from.ToLower(), to.ToLower());
|
||||
|
||||
@@ -78,10 +74,9 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.atl_set(from, to));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Translangs()
|
||||
public async partial Task Translangs()
|
||||
=> await ctx.Channel.SendTableAsync(_service.GetLanguages(), str => $"{str,-15}");
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class XkcdCommands : NadekoSubmodule
|
||||
public partial class XkcdCommands : NadekoSubmodule
|
||||
{
|
||||
private const string _xkcdUrl = "https://xkcd.com";
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
@@ -14,10 +14,9 @@ public partial class Searches
|
||||
public XkcdCommands(IHttpClientFactory factory)
|
||||
=> _httpFactory = factory;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Xkcd(string arg = null)
|
||||
public async partial Task Xkcd(string arg = null)
|
||||
{
|
||||
if (arg?.ToLowerInvariant().Trim() == "latest")
|
||||
{
|
||||
@@ -49,10 +48,9 @@ public partial class Searches
|
||||
await Xkcd(new NadekoRandom().Next(1, 1750));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Xkcd(int num)
|
||||
public async partial Task Xkcd(int num)
|
||||
{
|
||||
if (num < 1)
|
||||
return;
|
||||
|
@@ -4,7 +4,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
// [Group]
|
||||
// public class YtTrackCommands : NadekoSubmodule<YtTrackService>
|
||||
// public partial class YtTrackCommands : NadekoSubmodule<YtTrackService>
|
||||
// {
|
||||
// ;
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
|
Reference in New Issue
Block a user