mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -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:
@@ -7,11 +7,10 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class CalcCommands : NadekoSubmodule
|
||||
public partial class CalcCommands : NadekoSubmodule
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Calculate([Leftover] string expression)
|
||||
[Cmd]
|
||||
public async partial Task Calculate([Leftover] string expression)
|
||||
{
|
||||
var expr = new Expression(expression, EvaluateOptions.IgnoreCase | EvaluateOptions.NoCache);
|
||||
expr.EvaluateParameter += Expr_EvaluateParameter;
|
||||
@@ -35,9 +34,8 @@ public partial class Utility
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task CalcOps()
|
||||
[Cmd]
|
||||
public async partial Task CalcOps()
|
||||
{
|
||||
var selection = typeof(Math).GetTypeInfo()
|
||||
.GetMethods()
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class CommandMapCommands : NadekoSubmodule<CommandMapService>
|
||||
public partial class CommandMapCommands : NadekoSubmodule<CommandMapService>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -20,21 +20,19 @@ public partial class Utility
|
||||
_client = client;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AliasesClear()
|
||||
public async partial Task AliasesClear()
|
||||
{
|
||||
var count = _service.ClearAliases(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.aliases_cleared(count));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Alias(string trigger, [Leftover] string mapping = null)
|
||||
public async partial Task Alias(string trigger, [Leftover] string mapping = null)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -101,10 +99,9 @@ public partial class Utility
|
||||
}
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AliasList(int page = 1)
|
||||
public async partial Task AliasList(int page = 1)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
page -= 1;
|
||||
|
@@ -3,17 +3,16 @@ namespace NadekoBot.Modules.Utility;
|
||||
|
||||
public partial class Utility
|
||||
{
|
||||
public class ConfigCommands : NadekoSubmodule
|
||||
public partial class ConfigCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly IEnumerable<IConfigService> _settingServices;
|
||||
|
||||
public ConfigCommands(IEnumerable<IConfigService> settingServices)
|
||||
=> _settingServices = settingServices;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ConfigReload(string name)
|
||||
public async partial Task ConfigReload(string name)
|
||||
{
|
||||
var setting = _settingServices.FirstOrDefault(x
|
||||
=> x.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
@@ -34,10 +33,9 @@ public partial class Utility
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Config(string name = null, string prop = null, [Leftover] string value = null)
|
||||
public async partial Task Config(string name = null, string prop = null, [Leftover] string value = null)
|
||||
{
|
||||
var configNames = _settingServices.Select(x => x.Name);
|
||||
|
||||
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class InfoCommands : NadekoSubmodule
|
||||
public partial class InfoCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
private readonly IStatsService _stats;
|
||||
@@ -17,10 +17,9 @@ public partial class Utility
|
||||
_stats = stats;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ServerInfo(string guildName = null)
|
||||
public async partial Task ServerInfo(string guildName = null)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
guildName = guildName?.ToUpperInvariant();
|
||||
@@ -65,10 +64,9 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChannelInfo(ITextChannel channel = null)
|
||||
public async partial Task ChannelInfo(ITextChannel channel = null)
|
||||
{
|
||||
var ch = channel ?? (ITextChannel)ctx.Channel;
|
||||
if (ch is null)
|
||||
@@ -85,10 +83,9 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task UserInfo(IGuildUser usr = null)
|
||||
public async partial Task UserInfo(IGuildUser usr = null)
|
||||
{
|
||||
var user = usr ?? ctx.User as IGuildUser;
|
||||
|
||||
@@ -111,11 +108,10 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task Activity(int page = 1)
|
||||
public async partial Task Activity(int page = 1)
|
||||
{
|
||||
const int activityPerPage = 10;
|
||||
page -= 1;
|
||||
|
@@ -6,15 +6,14 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class InviteCommands : NadekoSubmodule<InviteService>
|
||||
public partial class InviteCommands : NadekoSubmodule<InviteService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(ChannelPerm.CreateInstantInvite)]
|
||||
[UserPerm(ChannelPerm.CreateInstantInvite)]
|
||||
[NadekoOptions(typeof(InviteService.Options))]
|
||||
public async Task InviteCreate(params string[] args)
|
||||
public async partial Task InviteCreate(params string[] args)
|
||||
{
|
||||
var (opts, success) = OptionsParser.ParseFrom(new InviteService.Options(), args);
|
||||
if (!success)
|
||||
@@ -26,12 +25,11 @@ public partial class Utility
|
||||
await SendConfirmAsync($"{ctx.User.Mention} https://discord.gg/{invite.Code}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(ChannelPerm.ManageChannels)]
|
||||
[UserPerm(ChannelPerm.ManageChannels)]
|
||||
public async Task InviteList(int page = 1, [Leftover] ITextChannel ch = null)
|
||||
public async partial Task InviteList(int page = 1, [Leftover] ITextChannel ch = null)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -71,12 +69,11 @@ public partial class Utility
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(ChannelPerm.ManageChannels)]
|
||||
[UserPerm(ChannelPerm.ManageChannels)]
|
||||
public async Task InviteDelete(int index)
|
||||
public async partial Task InviteDelete(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
|
@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class QuoteCommands : NadekoSubmodule
|
||||
public partial class QuoteCommands : NadekoSubmodule
|
||||
{
|
||||
private const string _prependExport =
|
||||
@"# Keys are keywords, Each key has a LIST of quotes in the following format:
|
||||
@@ -40,18 +40,16 @@ public partial class Utility
|
||||
_http = http;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task ListQuotes(OrderType order = OrderType.Keyword)
|
||||
public partial Task ListQuotes(OrderType order = OrderType.Keyword)
|
||||
=> ListQuotes(1, order);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task ListQuotes(int page = 1, OrderType order = OrderType.Keyword)
|
||||
public async partial Task ListQuotes(int page = 1, OrderType order = OrderType.Keyword)
|
||||
{
|
||||
page -= 1;
|
||||
if (page < 0)
|
||||
@@ -72,10 +70,9 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.quotes_page_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuotePrint([Leftover] string keyword)
|
||||
public async partial Task QuotePrint([Leftover] string keyword)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword))
|
||||
return;
|
||||
@@ -104,10 +101,9 @@ public partial class Utility
|
||||
await ctx.Channel.SendAsync($"`#{quote.Id}` 📣 " + text, true);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteShow(int id)
|
||||
public async partial Task QuoteShow(int id)
|
||||
{
|
||||
Quote quote;
|
||||
await using (var uow = _db.GetDbContext())
|
||||
@@ -136,10 +132,9 @@ public partial class Utility
|
||||
.WithFooter(
|
||||
GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})"))));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteSearch(string keyword, [Leftover] string text)
|
||||
public async partial Task QuoteSearch(string keyword, [Leftover] string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
@@ -161,10 +156,9 @@ public partial class Utility
|
||||
+ keywordquote.Text.SanitizeAllMentions());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteId(int id)
|
||||
public async partial Task QuoteId(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
return;
|
||||
@@ -194,10 +188,9 @@ public partial class Utility
|
||||
await ctx.Channel.SendAsync(infoText + text, true);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteAdd(string keyword, [Leftover] string text)
|
||||
public async partial Task QuoteAdd(string keyword, [Leftover] string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
@@ -221,10 +214,9 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.quote_added_new(Format.Code(q.Id.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteDelete(int id)
|
||||
public async partial Task QuoteDelete(int id)
|
||||
{
|
||||
var hasManageMessages = ((IGuildUser)ctx.Message.Author).GuildPermissions.ManageMessages;
|
||||
|
||||
@@ -253,11 +245,10 @@ public partial class Utility
|
||||
await SendErrorAsync(response);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task DelAllQuotes([Leftover] string keyword)
|
||||
public async partial Task DelAllQuotes([Leftover] string keyword)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword))
|
||||
return;
|
||||
@@ -274,11 +265,10 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.quotes_deleted(Format.Bold(keyword.SanitizeAllMentions())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task QuotesExport()
|
||||
public async partial Task QuotesExport()
|
||||
{
|
||||
IEnumerable<Quote> quotes;
|
||||
await using (var uow = _db.GetDbContext())
|
||||
@@ -295,15 +285,14 @@ public partial class Utility
|
||||
await ctx.Channel.SendFileAsync(stream, "quote-export.yml");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Ratelimit(300)]
|
||||
#if GLOBAL_NADEKO
|
||||
[OwnerOnly]
|
||||
#endif
|
||||
public async Task QuotesImport([Leftover] string input = null)
|
||||
public async partial Task QuotesImport([Leftover] string input = null)
|
||||
{
|
||||
input = input?.Trim();
|
||||
|
||||
@@ -338,7 +327,7 @@ public partial class Utility
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> ImportCrsAsync(ulong guildId, string input)
|
||||
private async Task<bool> ImportCrsAsync(ulong guildId, string input)
|
||||
{
|
||||
Dictionary<string, List<ExportedQuote>> data;
|
||||
try
|
||||
|
@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class RemindCommands : NadekoSubmodule<RemindService>
|
||||
public partial class RemindCommands : NadekoSubmodule<RemindService>
|
||||
{
|
||||
public enum MeOrHere
|
||||
{
|
||||
@@ -35,10 +35,9 @@ public partial class Utility
|
||||
_tz = tz;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Remind(MeOrHere meorhere, [Leftover] string remindString)
|
||||
public async partial Task Remind(MeOrHere meorhere, [Leftover] string remindString)
|
||||
{
|
||||
if (!_service.TryParseRemindMessage(remindString, out var remindData))
|
||||
{
|
||||
@@ -54,12 +53,11 @@ public partial class Utility
|
||||
remindData.What)) await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public async Task Remind(ITextChannel channel, [Leftover] string remindString)
|
||||
public async partial Task Remind(ITextChannel channel, [Leftover] string remindString)
|
||||
{
|
||||
var perms = ((IGuildUser)ctx.User).GetPermissions(channel);
|
||||
if (!perms.SendMessages || !perms.ViewChannel)
|
||||
@@ -79,18 +77,16 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public Task RemindList(Server _, int page = 1)
|
||||
public partial Task RemindList(Server _, int page = 1)
|
||||
=> RemindListInternal(page, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public Task RemindList(int page = 1)
|
||||
public partial Task RemindList(int page = 1)
|
||||
=> RemindListInternal(page, false);
|
||||
|
||||
private async Task RemindListInternal(int page, bool isServer)
|
||||
@@ -135,18 +131,16 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public Task RemindDelete(Server _, int index)
|
||||
public partial Task RemindDelete(Server _, int index)
|
||||
=> RemindDelete(index, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public Task RemindDelete(int index)
|
||||
public partial Task RemindDelete(int index)
|
||||
=> RemindDelete(index, false);
|
||||
|
||||
private async Task RemindDelete(int index, bool isServer)
|
||||
|
@@ -7,13 +7,12 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class RepeatCommands : NadekoSubmodule<RepeaterService>
|
||||
public partial class RepeatCommands : NadekoSubmodule<RepeaterService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatInvoke(int index)
|
||||
public async partial Task RepeatInvoke(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -22,11 +21,10 @@ public partial class Utility
|
||||
if (!success) await ReplyErrorLocalizedAsync(strs.repeat_invoke_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatRemove(int index)
|
||||
public async partial Task RepeatRemove(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -45,11 +43,10 @@ public partial class Utility
|
||||
.WithDescription(description));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatRedundant(int index)
|
||||
public async partial Task RepeatRedundant(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -68,36 +65,32 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.repeater_redundant_yes(index + 1));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(-1)]
|
||||
public Task Repeat([Leftover] string message)
|
||||
public partial Task Repeat([Leftover] string message)
|
||||
=> Repeat(null, null, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public Task Repeat(StoopidTime interval, [Leftover] string message)
|
||||
public partial Task Repeat(StoopidTime interval, [Leftover] string message)
|
||||
=> Repeat(null, interval, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public Task Repeat(GuildDateTime dt, [Leftover] string message)
|
||||
public partial Task Repeat(GuildDateTime dt, [Leftover] string message)
|
||||
=> Repeat(dt, null, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(2)]
|
||||
public async Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
|
||||
public async partial Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
|
||||
{
|
||||
var startTimeOfDay = dt?.InputTimeUtc.TimeOfDay;
|
||||
// if interval not null, that means user specified it (don't change it)
|
||||
@@ -137,11 +130,10 @@ public partial class Utility
|
||||
.WithDescription(description));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatList()
|
||||
public async partial Task RepeatList()
|
||||
{
|
||||
var repeaters = _service.GetRepeaters(ctx.Guild.Id);
|
||||
if (repeaters.Count == 0)
|
||||
|
@@ -6,14 +6,13 @@ namespace NadekoBot.Modules.Utility;
|
||||
|
||||
public partial class Utility
|
||||
{
|
||||
public class StreamRoleCommands : NadekoSubmodule<StreamRoleService>
|
||||
public partial class StreamRoleCommands : NadekoSubmodule<StreamRoleService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRole(IRole fromRole, IRole addRole)
|
||||
public async partial Task StreamRole(IRole fromRole, IRole addRole)
|
||||
{
|
||||
await _service.SetStreamRole(fromRole, addRole);
|
||||
|
||||
@@ -21,23 +20,21 @@ public partial class Utility
|
||||
Format.Bold(addRole.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRole()
|
||||
public async partial Task StreamRole()
|
||||
{
|
||||
await _service.StopStreamRole(ctx.Guild);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleKeyword([Leftover] string keyword = null)
|
||||
public async partial Task StreamRoleKeyword([Leftover] string keyword = null)
|
||||
{
|
||||
var kw = await _service.SetKeyword(ctx.Guild, keyword);
|
||||
|
||||
@@ -47,12 +44,11 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_set(Format.Bold(kw)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user)
|
||||
public async partial Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user)
|
||||
{
|
||||
var success = await _service.ApplyListAction(StreamRoleListType.Blacklist,
|
||||
ctx.Guild,
|
||||
@@ -71,12 +67,11 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.stream_role_bl_rem_fail(Format.Bold(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user)
|
||||
public async partial Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user)
|
||||
{
|
||||
var success = await _service.ApplyListAction(StreamRoleListType.Whitelist,
|
||||
ctx.Guild,
|
||||
|
@@ -6,11 +6,10 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class UnitConverterCommands : NadekoSubmodule<ConverterService>
|
||||
public partial class UnitConverterCommands : NadekoSubmodule<ConverterService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ConvertList()
|
||||
[Cmd]
|
||||
public async partial Task ConvertList()
|
||||
{
|
||||
var units = _service.Units;
|
||||
|
||||
@@ -24,10 +23,9 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Convert(string origin, string target, decimal value)
|
||||
public async partial Task Convert(string origin, string target, decimal value)
|
||||
{
|
||||
var originUnit = _service.Units.FirstOrDefault(x
|
||||
=> x.Triggers.Select(y => y.ToUpperInvariant()).Contains(origin.ToUpperInvariant()));
|
||||
|
@@ -49,12 +49,11 @@ public partial class Utility : NadekoModule
|
||||
_httpFactory = httpFactory;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task Say(ITextChannel channel, [Leftover] SmartText message)
|
||||
public async partial Task Say(ITextChannel channel, [Leftover] SmartText message)
|
||||
{
|
||||
var rep = new ReplacementBuilder()
|
||||
.WithDefault(ctx.User, channel, (SocketGuild)ctx.Guild, (DiscordSocketClient)ctx.Client)
|
||||
@@ -65,18 +64,16 @@ public partial class Utility : NadekoModule
|
||||
await channel.SendAsync(message, !((IGuildUser)ctx.User).GuildPermissions.MentionEveryone);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public Task Say([Leftover] SmartText message)
|
||||
public partial Task Say([Leftover] SmartText message)
|
||||
=> Say((ITextChannel)ctx.Channel, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task WhosPlaying([Leftover] string game)
|
||||
public async partial Task WhosPlaying([Leftover] string game)
|
||||
{
|
||||
game = game?.Trim().ToUpperInvariant();
|
||||
if (string.IsNullOrWhiteSpace(game))
|
||||
@@ -108,11 +105,10 @@ public partial class Utility : NadekoModule
|
||||
+ "\n```");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task InRole(int page, [Leftover] IRole role = null)
|
||||
public async partial Task InRole(int page, [Leftover] IRole role = null)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -147,17 +143,15 @@ public partial class Utility : NadekoModule
|
||||
20);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task InRole([Leftover] IRole role = null)
|
||||
public partial Task InRole([Leftover] IRole role = null)
|
||||
=> InRole(1, role);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task CheckPerms(MeOrBot who = MeOrBot.Me)
|
||||
public async partial Task CheckPerms(MeOrBot who = MeOrBot.Me)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
var user = who == MeOrBot.Me ? (IGuildUser)ctx.User : ((SocketGuild)ctx.Guild).CurrentUser;
|
||||
@@ -167,10 +161,9 @@ public partial class Utility : NadekoModule
|
||||
await SendConfirmAsync(builder.ToString());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task UserId([Leftover] IGuildUser target = null)
|
||||
public async partial Task UserId([Leftover] IGuildUser target = null)
|
||||
{
|
||||
var usr = target ?? ctx.User;
|
||||
await ReplyConfirmLocalizedAsync(strs.userid("🆔",
|
||||
@@ -178,29 +171,25 @@ public partial class Utility : NadekoModule
|
||||
Format.Code(usr.Id.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RoleId([Leftover] IRole role)
|
||||
public async partial Task RoleId([Leftover] IRole role)
|
||||
=> await ReplyConfirmLocalizedAsync(strs.roleid("🆔",
|
||||
Format.Bold(role.ToString()),
|
||||
Format.Code(role.Id.ToString())));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ChannelId()
|
||||
[Cmd]
|
||||
public async partial Task ChannelId()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.channelid("🆔", Format.Code(ctx.Channel.Id.ToString())));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ServerId()
|
||||
public async partial Task ServerId()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.serverid("🆔", Format.Code(ctx.Guild.Id.ToString())));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Roles(IGuildUser target, int page = 1)
|
||||
public async partial Task Roles(IGuildUser target, int page = 1)
|
||||
{
|
||||
var guild = ctx.Guild;
|
||||
|
||||
@@ -238,16 +227,14 @@ public partial class Utility : NadekoModule
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Roles(int page = 1)
|
||||
public partial Task Roles(int page = 1)
|
||||
=> Roles(null, page);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChannelTopic([Leftover] ITextChannel channel = null)
|
||||
public async partial Task ChannelTopic([Leftover] ITextChannel channel = null)
|
||||
{
|
||||
if (channel is null)
|
||||
channel = (ITextChannel)ctx.Channel;
|
||||
@@ -259,9 +246,8 @@ public partial class Utility : NadekoModule
|
||||
await SendConfirmAsync(GetText(strs.channel_topic), topic);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Stats()
|
||||
[Cmd]
|
||||
public async partial Task Stats()
|
||||
{
|
||||
var ownerIds = string.Join("\n", _creds.OwnerIds);
|
||||
if (string.IsNullOrWhiteSpace(ownerIds))
|
||||
@@ -293,9 +279,8 @@ public partial class Utility : NadekoModule
|
||||
true));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task
|
||||
[Cmd]
|
||||
public async partial Task
|
||||
Showemojis([Leftover] string _) // need to have the parameter so that the message.tags gets populated
|
||||
{
|
||||
var tags = ctx.Message.Tags.Where(t => t.Type == TagType.Emoji).Select(t => (Emote)t.Value);
|
||||
@@ -308,31 +293,28 @@ public partial class Utility : NadekoModule
|
||||
await ctx.Channel.SendMessageAsync(result.TrimTo(2000));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(GuildPerm.ManageEmojisAndStickers)]
|
||||
[UserPerm(GuildPerm.ManageEmojisAndStickers)]
|
||||
[Priority(2)]
|
||||
public Task EmojiAdd(string name, Emote emote)
|
||||
public partial Task EmojiAdd(string name, Emote emote)
|
||||
=> EmojiAdd(name, emote.Url);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(GuildPerm.ManageEmojisAndStickers)]
|
||||
[UserPerm(GuildPerm.ManageEmojisAndStickers)]
|
||||
[Priority(1)]
|
||||
public Task EmojiAdd(Emote emote)
|
||||
public partial Task EmojiAdd(Emote emote)
|
||||
=> EmojiAdd(emote.Name, emote.Url);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(GuildPerm.ManageEmojisAndStickers)]
|
||||
[UserPerm(GuildPerm.ManageEmojisAndStickers)]
|
||||
[Priority(0)]
|
||||
public async Task EmojiAdd(string name, string url = null)
|
||||
public async partial Task EmojiAdd(string name, string url = null)
|
||||
{
|
||||
name = name.Trim(':');
|
||||
|
||||
@@ -366,10 +348,9 @@ public partial class Utility : NadekoModule
|
||||
await ConfirmLocalizedAsync(strs.emoji_added(em.ToString()));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ListServers(int page = 1)
|
||||
public async partial Task ListServers(int page = 1)
|
||||
{
|
||||
page -= 1;
|
||||
|
||||
@@ -391,16 +372,14 @@ public partial class Utility : NadekoModule
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task ShowEmbed(ulong messageId)
|
||||
public partial Task ShowEmbed(ulong messageId)
|
||||
=> ShowEmbed((ITextChannel)ctx.Channel, messageId);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ShowEmbed(ITextChannel ch, ulong messageId)
|
||||
public async partial Task ShowEmbed(ITextChannel ch, ulong messageId)
|
||||
{
|
||||
var user = (IGuildUser)ctx.User;
|
||||
var perms = user.GetPermissions(ch);
|
||||
@@ -428,11 +407,10 @@ public partial class Utility : NadekoModule
|
||||
await SendConfirmAsync(Format.Sanitize(json).Replace("](", "]\\("));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task SaveChat(int cnt)
|
||||
public async partial Task SaveChat(int cnt)
|
||||
{
|
||||
var msgs = new List<IMessage>(cnt);
|
||||
await ctx.Channel.GetMessagesAsync(cnt).ForEachAsync(dled => msgs.AddRange(dled));
|
||||
@@ -469,12 +447,11 @@ public partial class Utility : NadekoModule
|
||||
await ctx.User.SendFileAsync(stream, title, title);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
#if GLOBAL_NADEKO
|
||||
[Ratelimit(30)]
|
||||
#endif
|
||||
public async Task Ping()
|
||||
public async partial Task Ping()
|
||||
{
|
||||
await sem.WaitAsync(5000);
|
||||
try
|
||||
@@ -511,7 +488,7 @@ public partial class Utility : NadekoModule
|
||||
//
|
||||
// [NadekoCommand, Usage, Description, Aliases]
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
// public async Task InviteLb(int page = 1)
|
||||
// public async partial Task InviteLb(int page = 1)
|
||||
// {
|
||||
// if (--page < 0)
|
||||
// return;
|
||||
|
@@ -6,13 +6,12 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class VerboseErrorCommands : NadekoSubmodule<VerboseErrorsService>
|
||||
public partial class VerboseErrorCommands : NadekoSubmodule<VerboseErrorsService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task VerboseError(bool? newstate = null)
|
||||
public async partial Task VerboseError(bool? newstate = null)
|
||||
{
|
||||
var state = _service.ToggleVerboseErrors(ctx.Guild.Id, newstate);
|
||||
|
||||
|
Reference in New Issue
Block a user