- 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:
Kwoth
2021-12-31 16:04:12 +01:00
parent 6eee161b6b
commit 25eeffa163
107 changed files with 1620 additions and 3236 deletions

View File

@@ -3,13 +3,12 @@ namespace NadekoBot.Modules.Administration;
public partial class Administration
{
[Group]
public class ServerGreetCommands : NadekoSubmodule<GreetSettingsService>
public partial class GreetCommands : NadekoSubmodule<GreetService>
{
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task Boost()
public async partial Task Boost()
{
var enabled = await _service.ToggleBoost(ctx.Guild.Id, ctx.Channel.Id);
@@ -19,11 +18,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.boost_off);
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task BoostDel(int timer = 30)
public async partial Task BoostDel(int timer = 30)
{
if (timer is < 0 or > 600)
return;
@@ -36,11 +34,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.boostdel_off);
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task BoostMsg([Leftover] string? text = null)
public async partial Task BoostMsg([Leftover] string? text = null)
{
if (string.IsNullOrWhiteSpace(text))
{
@@ -56,11 +53,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.boostmsg_enable($"`{Prefix}boost`"));
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task GreetDel(int timer = 30)
public async partial Task GreetDel(int timer = 30)
{
if (timer is < 0 or > 600)
return;
@@ -73,11 +69,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.greetdel_off);
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task Greet()
public async partial Task Greet()
{
var enabled = await _service.SetGreet(ctx.Guild.Id, ctx.Channel.Id);
@@ -87,11 +82,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.greet_off);
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task GreetMsg([Leftover] string? text = null)
public async partial Task GreetMsg([Leftover] string? text = null)
{
if (string.IsNullOrWhiteSpace(text))
{
@@ -108,11 +102,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task GreetDm()
public async partial Task GreetDm()
{
var enabled = await _service.SetGreetDm(ctx.Guild.Id);
@@ -122,11 +115,10 @@ public partial class Administration
await ReplyConfirmLocalizedAsync(strs.greetdm_off);
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task GreetDmMsg([Leftover] string? text = null)
public async partial Task GreetDmMsg([Leftover] string? text = null)
{
if (string.IsNullOrWhiteSpace(text))
{
@@ -142,11 +134,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`"));
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task Bye()
public async partial Task Bye()
{
var enabled = await _service.SetBye(ctx.Guild.Id, ctx.Channel.Id);
@@ -156,11 +147,10 @@ public partial class Administration
await ReplyConfirmLocalizedAsync(strs.bye_off);
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task ByeMsg([Leftover] string? text = null)
public async partial Task ByeMsg([Leftover] string? text = null)
{
if (string.IsNullOrWhiteSpace(text))
{
@@ -176,11 +166,10 @@ public partial class Administration
await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public async Task ByeDel(int timer = 30)
public async partial Task ByeDel(int timer = 30)
{
await _service.SetByeDel(ctx.Guild.Id, timer);
@@ -191,12 +180,11 @@ public partial class Administration
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
[Ratelimit(5)]
public async Task ByeTest([Leftover] IGuildUser? user = null)
public async partial Task ByeTest([Leftover] IGuildUser? user = null)
{
user ??= (IGuildUser)ctx.User;
@@ -205,12 +193,11 @@ public partial class Administration
if (!enabled) await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
[Ratelimit(5)]
public async Task GreetTest([Leftover] IGuildUser? user = null)
public async partial Task GreetTest([Leftover] IGuildUser? user = null)
{
user ??= (IGuildUser)ctx.User;
@@ -219,12 +206,11 @@ public partial class Administration
if (!enabled) await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
}
[NadekoCommand]
[Aliases]
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
[Ratelimit(5)]
public async Task GreetDmTest([Leftover] IGuildUser? user = null)
public async partial Task GreetDmTest([Leftover] IGuildUser? user = null)
{
user ??= (IGuildUser)ctx.User;

View File

@@ -3,7 +3,7 @@ using NadekoBot.Services.Database.Models;
namespace NadekoBot.Services;
public class GreetSettingsService : INService
public class GreetService : INService
{
public bool GroupGreets
=> _bss.Data.GroupGreets;
@@ -17,7 +17,7 @@ public class GreetSettingsService : INService
private readonly GreetGrouper<IUser> _byes = new();
private readonly BotConfigService _bss;
public GreetSettingsService(
public GreetService(
DiscordSocketClient client,
Bot bot,
DbService db,