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:
Kwoth
2022-07-18 04:33:50 +02:00
parent 3db194c186
commit 99c60459f8
98 changed files with 747 additions and 788 deletions

View File

@@ -39,7 +39,7 @@ public partial class Administration
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[OwnerOnly]
public async partial Task StartupCommandAdd([Leftover] string cmdText)
public async Task StartupCommandAdd([Leftover] string cmdText)
{
if (cmdText.StartsWith(prefix + "die", StringComparison.InvariantCulture))
return;
@@ -72,7 +72,7 @@ public partial class Administration
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[OwnerOnly]
public async partial Task AutoCommandAdd(int interval, [Leftover] string cmdText)
public async Task AutoCommandAdd(int interval, [Leftover] string cmdText)
{
if (cmdText.StartsWith(prefix + "die", StringComparison.InvariantCulture))
return;
@@ -100,7 +100,7 @@ public partial class Administration
[Cmd]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
public async partial Task StartupCommandsList(int page = 1)
public async Task StartupCommandsList(int page = 1)
{
if (page-- < 1)
return;
@@ -126,7 +126,7 @@ public partial class Administration
[Cmd]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
public async partial Task AutoCommandsList(int page = 1)
public async Task AutoCommandsList(int page = 1)
{
if (page-- < 1)
return;
@@ -154,7 +154,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task Wait(int miliseconds)
public async Task Wait(int miliseconds)
{
if (miliseconds <= 0)
return;
@@ -173,7 +173,7 @@ public partial class Administration
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[OwnerOnly]
public async partial Task AutoCommandRemove([Leftover] int index)
public async Task AutoCommandRemove([Leftover] int index)
{
if (!_service.RemoveAutoCommand(--index, out _))
{
@@ -187,7 +187,7 @@ public partial class Administration
[Cmd]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
public async partial Task StartupCommandRemove([Leftover] int index)
public async Task StartupCommandRemove([Leftover] int index)
{
if (!_service.RemoveStartupCommand(--index, out _))
await ReplyErrorLocalizedAsync(strs.scrm_fail);
@@ -199,7 +199,7 @@ public partial class Administration
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[OwnerOnly]
public async partial Task StartupCommandsClear()
public async Task StartupCommandsClear()
{
_service.ClearStartupCommands();
@@ -208,7 +208,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task ForwardMessages()
public async Task ForwardMessages()
{
var enabled = _service.ForwardMessages();
@@ -220,7 +220,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task ForwardToAll()
public async Task ForwardToAll()
{
var enabled = _service.ForwardToAll();
@@ -231,7 +231,7 @@ public partial class Administration
}
[Cmd]
public async partial Task ShardStats(int page = 1)
public async Task ShardStats(int page = 1)
{
if (--page < 0)
return;
@@ -284,7 +284,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task RestartShard(int shardId)
public async Task RestartShard(int shardId)
{
var success = _coord.RestartShard(shardId);
if (success)
@@ -295,12 +295,12 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public partial Task Leave([Leftover] string guildStr)
public Task Leave([Leftover] string guildStr)
=> _service.LeaveGuild(guildStr);
[Cmd]
[OwnerOnly]
public async partial Task DeleteEmptyServers()
public async Task DeleteEmptyServers()
{
await ctx.Channel.TriggerTypingAsync();
@@ -331,7 +331,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task Die(bool graceful = false)
public async Task Die(bool graceful = false)
{
try
{
@@ -350,7 +350,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task Restart()
public async Task Restart()
{
var success = _coord.RestartBot();
if (!success)
@@ -365,7 +365,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task SetName([Leftover] string newName)
public async Task SetName([Leftover] string newName)
{
if (string.IsNullOrWhiteSpace(newName))
return;
@@ -386,7 +386,7 @@ public partial class Administration
[UserPerm(GuildPerm.ManageNicknames)]
[BotPerm(GuildPerm.ChangeNickname)]
[Priority(0)]
public async partial Task SetNick([Leftover] string newNick = null)
public async Task SetNick([Leftover] string newNick = null)
{
if (string.IsNullOrWhiteSpace(newNick))
return;
@@ -400,7 +400,7 @@ public partial class Administration
[BotPerm(GuildPerm.ManageNicknames)]
[UserPerm(GuildPerm.ManageNicknames)]
[Priority(1)]
public async partial Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
public async Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
{
var sg = (SocketGuild)ctx.Guild;
if (sg.OwnerId == gu.Id
@@ -417,7 +417,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task SetStatus([Leftover] SettableUserStatus status)
public async Task SetStatus([Leftover] SettableUserStatus status)
{
await _client.SetStatusAsync(SettableUserStatusToUserStatus(status));
@@ -426,7 +426,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task SetAvatar([Leftover] string img = null)
public async Task SetAvatar([Leftover] string img = null)
{
var success = await _service.SetAvatar(img);
@@ -436,7 +436,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task SetGame(ActivityType type, [Leftover] string game = null)
public async Task SetGame(ActivityType type, [Leftover] string game = null)
{
var rep = new ReplacementBuilder().WithDefault(Context).Build();
@@ -447,7 +447,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task SetStream(string url, [Leftover] string name = null)
public async Task SetStream(string url, [Leftover] string name = null)
{
name ??= "";
@@ -458,7 +458,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task Send(string where, [Leftover] SmartText text = null)
public async Task Send(string where, [Leftover] SmartText text = null)
{
var ids = where.Split('|');
if (ids.Length != 2)
@@ -504,7 +504,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task StringsReload()
public async Task StringsReload()
{
_strings.Reload();
await _medusaLoader.ReloadStrings();
@@ -513,7 +513,7 @@ public partial class Administration
[Cmd]
[OwnerOnly]
public async partial Task CoordReload()
public async Task CoordReload()
{
await _coord.Reload();
await ctx.OkAsync();