mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Removed cmd source generator. Commands are no longer partial methods. Compilations should be slightly faster now. Updated packages and adapted drawing code to the new apis. There may be some bugs.
This commit is contained in:
@@ -69,7 +69,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task UserBlacklist(int page = 1)
|
||||
public Task UserBlacklist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -79,7 +79,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task ChannelBlacklist(int page = 1)
|
||||
public Task ChannelBlacklist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -89,7 +89,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task ServerBlacklist(int page = 1)
|
||||
public Task ServerBlacklist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -99,27 +99,27 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task UserBlacklist(AddRemove action, ulong id)
|
||||
public Task UserBlacklist(AddRemove action, ulong id)
|
||||
=> Blacklist(action, id, BlacklistType.User);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task UserBlacklist(AddRemove action, IUser usr)
|
||||
public Task UserBlacklist(AddRemove action, IUser usr)
|
||||
=> Blacklist(action, usr.Id, BlacklistType.User);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task ChannelBlacklist(AddRemove action, ulong id)
|
||||
public Task ChannelBlacklist(AddRemove action, ulong id)
|
||||
=> Blacklist(action, id, BlacklistType.Channel);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task ServerBlacklist(AddRemove action, ulong id)
|
||||
public Task ServerBlacklist(AddRemove action, ulong id)
|
||||
=> Blacklist(action, id, BlacklistType.Server);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task ServerBlacklist(AddRemove action, IGuild guild)
|
||||
public Task ServerBlacklist(AddRemove action, IGuild guild)
|
||||
=> Blacklist(action, guild.Id, BlacklistType.Server);
|
||||
|
||||
private async Task Blacklist(AddRemove action, ulong id, BlacklistType type)
|
||||
|
@@ -73,18 +73,18 @@ public partial class Permissions
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public partial Task CmdCooldown(CleverBotResponseStr command, int secs)
|
||||
public Task CmdCooldown(CleverBotResponseStr command, int secs)
|
||||
=> CmdCooldownInternal(CleverBotResponseStr.CLEVERBOT_RESPONSE, secs);
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public partial Task CmdCooldown(CommandOrExprInfo command, int secs)
|
||||
public Task CmdCooldown(CommandOrExprInfo command, int secs)
|
||||
=> CmdCooldownInternal(command.Name, secs);
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task AllCmdCooldowns()
|
||||
public async Task AllCmdCooldowns()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
var localSet = CommandCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CommandCooldown>());
|
||||
|
@@ -19,7 +19,7 @@ public partial class Permissions
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async partial Task FwClear()
|
||||
public async Task FwClear()
|
||||
{
|
||||
_service.ClearFilteredWords(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.fw_cleared);
|
||||
@@ -27,7 +27,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task SrvrFilterInv()
|
||||
public async Task SrvrFilterInv()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -53,7 +53,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task ChnlFilterInv()
|
||||
public async Task ChnlFilterInv()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -89,7 +89,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task SrvrFilterLin()
|
||||
public async Task SrvrFilterLin()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -115,7 +115,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task ChnlFilterLin()
|
||||
public async Task ChnlFilterLin()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -151,7 +151,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task SrvrFilterWords()
|
||||
public async Task SrvrFilterWords()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -177,7 +177,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task ChnlFilterWords()
|
||||
public async Task ChnlFilterWords()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -213,7 +213,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task FilterWord([Leftover] string word)
|
||||
public async Task FilterWord([Leftover] string word)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -259,7 +259,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task LstFilterWords(int page = 1)
|
||||
public async Task LstFilterWords(int page = 1)
|
||||
{
|
||||
page--;
|
||||
if (page < 0)
|
||||
|
@@ -20,7 +20,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async partial Task GlobalPermList()
|
||||
public async Task GlobalPermList()
|
||||
{
|
||||
var blockedModule = _service.BlockedModules;
|
||||
var blockedCommands = _service.BlockedCommands;
|
||||
@@ -43,7 +43,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async partial Task GlobalModule(ModuleOrCrInfo module)
|
||||
public async Task GlobalModule(ModuleOrCrInfo module)
|
||||
{
|
||||
var moduleName = module.Name.ToLowerInvariant();
|
||||
|
||||
@@ -60,7 +60,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async partial Task GlobalCommand(CommandOrExprInfo cmd)
|
||||
public async Task GlobalCommand(CommandOrExprInfo cmd)
|
||||
{
|
||||
var commandName = cmd.Name.ToLowerInvariant();
|
||||
var added = _service.ToggleCommand(commandName);
|
||||
|
@@ -19,7 +19,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task Verbose(PermissionAction action = null)
|
||||
public async Task Verbose(PermissionAction action = null)
|
||||
{
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public async partial Task PermRole([Leftover] IRole role = null)
|
||||
public async Task PermRole([Leftover] IRole role = null)
|
||||
{
|
||||
if (role is not null && role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(1)]
|
||||
public async partial Task PermRole(Reset _)
|
||||
public async Task PermRole(Reset _)
|
||||
{
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
@@ -87,7 +87,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task ListPerms(int page = 1)
|
||||
public async Task ListPerms(int page = 1)
|
||||
{
|
||||
if (page < 1)
|
||||
return;
|
||||
@@ -120,7 +120,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task RemovePerm(int index)
|
||||
public async Task RemovePerm(int index)
|
||||
{
|
||||
index -= 1;
|
||||
if (index < 0)
|
||||
@@ -150,7 +150,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task MovePerm(int from, int to)
|
||||
public async Task MovePerm(int from, int to)
|
||||
{
|
||||
from -= 1;
|
||||
to -= 1;
|
||||
@@ -204,7 +204,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task SrvrCmd(CommandOrExprInfo command, PermissionAction action)
|
||||
public async Task SrvrCmd(CommandOrExprInfo command, PermissionAction action)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -225,7 +225,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task SrvrMdl(ModuleOrCrInfo module, PermissionAction action)
|
||||
public async Task SrvrMdl(ModuleOrCrInfo module, PermissionAction action)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -245,7 +245,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task UsrCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] IGuildUser user)
|
||||
public async Task UsrCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] IGuildUser user)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -274,7 +274,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task UsrMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IGuildUser user)
|
||||
public async Task UsrMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IGuildUser user)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -302,7 +302,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task RoleCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] IRole role)
|
||||
public async Task RoleCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -334,7 +334,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task RoleMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IRole role)
|
||||
public async Task RoleMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -366,7 +366,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task ChnlCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
public async Task ChnlCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -395,7 +395,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task ChnlMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
public async Task ChnlMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -423,7 +423,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task AllChnlMdls(PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
public async Task AllChnlMdls(PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -443,7 +443,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task AllRoleMdls(PermissionAction action, [Leftover] IRole role)
|
||||
public async Task AllRoleMdls(PermissionAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -466,7 +466,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task AllUsrMdls(PermissionAction action, [Leftover] IUser user)
|
||||
public async Task AllUsrMdls(PermissionAction action, [Leftover] IUser user)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -486,7 +486,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async partial Task AllSrvrMdls(PermissionAction action)
|
||||
public async Task AllSrvrMdls(PermissionAction action)
|
||||
{
|
||||
var newPerm = new Permissionv2
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@ public partial class Permissions
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async partial Task ResetPerms()
|
||||
public async Task ResetPerms()
|
||||
{
|
||||
await _perms.Reset(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.perms_reset);
|
||||
@@ -28,7 +28,7 @@ public partial class Permissions
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async partial Task ResetGlobalPerms()
|
||||
public async Task ResetGlobalPerms()
|
||||
{
|
||||
await _gps.Reset();
|
||||
await ReplyConfirmLocalizedAsync(strs.global_perms_reset);
|
||||
|
Reference in New Issue
Block a user