diff --git a/NadekoBot.sln b/NadekoBot.sln index 024214cc4..e0ca13c78 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -12,6 +12,7 @@ ProjectSection(SolutionItems) = preProject README.md = README.md .gitlab-ci.yml = .gitlab-ci.yml Dockerfile = Dockerfile + NuGet.Config = NuGet.Config EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NadekoBot", "src\NadekoBot\NadekoBot.csproj", "{45EC1473-C678-4857-A544-07DFE0D0B478}" diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 000000000..a1085fa80 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Nadeko.Medusa/Nadeko.Medusa.csproj b/src/Nadeko.Medusa/Nadeko.Medusa.csproj index ea296c692..7b152459e 100644 --- a/src/Nadeko.Medusa/Nadeko.Medusa.csproj +++ b/src/Nadeko.Medusa/Nadeko.Medusa.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/NadekoBot/Common/Attributes/NadekoCommand.cs b/src/NadekoBot/Common/Attributes/NadekoCommand.cs index 486bddf25..17389d841 100644 --- a/src/NadekoBot/Common/Attributes/NadekoCommand.cs +++ b/src/NadekoBot/Common/Attributes/NadekoCommand.cs @@ -3,11 +3,16 @@ using System.Runtime.CompilerServices; namespace NadekoBot.Common.Attributes; [AttributeUsage(AttributeTargets.Method)] -public sealed class NadekoCommandAttribute : CommandAttribute +public sealed class CmdAttribute : CommandAttribute { public string MethodName { get; } - public NadekoCommandAttribute([CallerMemberName] string memberName = "") + public CmdAttribute([CallerMemberName] string memberName = "") : base(CommandNameLoadHelper.GetCommandNameFor(memberName)) - => MethodName = memberName.ToLowerInvariant(); + { + MethodName = memberName.ToLowerInvariant(); + Aliases = CommandNameLoadHelper.GetAliasesFor(memberName); + Remarks = memberName.ToLowerInvariant(); + // Summary = memberName.ToLowerInvariant(); + } } \ No newline at end of file diff --git a/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs b/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs index 4288bd3b2..3c80d2d32 100644 --- a/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs +++ b/src/NadekoBot/Common/Attributes/NadekoModuleAttribute.cs @@ -1,30 +1,32 @@ -using System.Runtime.CompilerServices; +// using System.Runtime.CompilerServices; +// +// namespace NadekoBot.Common.Attributes; +// +// [AttributeUsage(AttributeTargets.Class)] +// internal sealed class NadekoModuleAttribute : GroupAttribute +// { +// public NadekoModuleAttribute(string moduleName) +// : base(moduleName) +// { +// } +// } +// +// [AttributeUsage(AttributeTargets.Method)] +// internal sealed class NadekoDescriptionAttribute : SummaryAttribute +// { +// public NadekoDescriptionAttribute([CallerMemberName] string name = "") +// : base(name.ToLowerInvariant()) +// { +// } +// } +// +// [AttributeUsage(AttributeTargets.Method)] +// internal sealed class NadekoUsageAttribute : RemarksAttribute +// { +// public NadekoUsageAttribute([CallerMemberName] string name = "") +// : base(name.ToLowerInvariant()) +// { +// } +// } -namespace NadekoBot.Common.Attributes; - -[AttributeUsage(AttributeTargets.Class)] -internal sealed class NadekoModuleAttribute : GroupAttribute -{ - public NadekoModuleAttribute(string moduleName) - : base(moduleName) - { - } -} - -[AttributeUsage(AttributeTargets.Method)] -internal sealed class NadekoDescriptionAttribute : SummaryAttribute -{ - public NadekoDescriptionAttribute([CallerMemberName] string name = "") - : base(name.ToLowerInvariant()) - { - } -} - -[AttributeUsage(AttributeTargets.Method)] -internal sealed class NadekoUsageAttribute : RemarksAttribute -{ - public NadekoUsageAttribute([CallerMemberName] string name = "") - : base(name.ToLowerInvariant()) - { - } -} \ No newline at end of file +// todo remove these \ No newline at end of file diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index 359c4685a..6bdac960d 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -41,7 +41,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.ManageGuild)] - public async partial Task ImageOnlyChannel(StoopidTime time = null) + public async Task ImageOnlyChannel(StoopidTime time = null) { var newValue = _imageOnly.ToggleImageOnlyChannel(ctx.Guild.Id, ctx.Channel.Id); if (newValue) @@ -54,7 +54,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(ChannelPerm.ManageChannels)] [BotPerm(ChannelPerm.ManageChannels)] - public async partial Task Slowmode(StoopidTime time = null) + public async Task Slowmode(StoopidTime time = null) { var seconds = (int?)time?.Time.TotalSeconds ?? 0; if (time is not null && (time.Time < TimeSpan.FromSeconds(0) || time.Time > TimeSpan.FromHours(6))) @@ -73,7 +73,7 @@ public partial class Administration : NadekoModule [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.ManageMessages)] [Priority(2)] - public async partial Task Delmsgoncmd(List _) + public async Task Delmsgoncmd(List _) { var guild = (SocketGuild)ctx.Guild; var (enabled, channels) = _service.GetDelMsgOnCmdData(ctx.Guild.Id); @@ -104,7 +104,7 @@ public partial class Administration : NadekoModule [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.ManageMessages)] [Priority(1)] - public async partial Task Delmsgoncmd(Server _ = Server.Server) + public async Task Delmsgoncmd(Server _ = Server.Server) { if (_service.ToggleDeleteMessageOnCommand(ctx.Guild.Id)) { @@ -123,7 +123,7 @@ public partial class Administration : NadekoModule [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.ManageMessages)] [Priority(0)] - public partial Task Delmsgoncmd(Channel _, State s, ITextChannel ch) + public Task Delmsgoncmd(Channel _, State s, ITextChannel ch) => Delmsgoncmd(_, s, ch.Id); [Cmd] @@ -131,7 +131,7 @@ public partial class Administration : NadekoModule [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.ManageMessages)] [Priority(1)] - public async partial Task Delmsgoncmd(Channel _, State s, ulong? chId = null) + public async Task Delmsgoncmd(Channel _, State s, ulong? chId = null) { var actualChId = chId ?? ctx.Channel.Id; await _service.SetDelMsgOnCmdState(ctx.Guild.Id, actualChId, s); @@ -148,7 +148,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.DeafenMembers)] [BotPerm(GuildPerm.DeafenMembers)] - public async partial Task Deafen(params IGuildUser[] users) + public async Task Deafen(params IGuildUser[] users) { await _service.DeafenUsers(true, users); await ReplyConfirmLocalizedAsync(strs.deafen); @@ -158,7 +158,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.DeafenMembers)] [BotPerm(GuildPerm.DeafenMembers)] - public async partial Task UnDeafen(params IGuildUser[] users) + public async Task UnDeafen(params IGuildUser[] users) { await _service.DeafenUsers(false, users); await ReplyConfirmLocalizedAsync(strs.undeafen); @@ -168,7 +168,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task DelVoiChanl([Leftover] IVoiceChannel voiceChannel) + public async Task DelVoiChanl([Leftover] IVoiceChannel voiceChannel) { await voiceChannel.DeleteAsync(); await ReplyConfirmLocalizedAsync(strs.delvoich(Format.Bold(voiceChannel.Name))); @@ -178,7 +178,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task CreatVoiChanl([Leftover] string channelName) + public async Task CreatVoiChanl([Leftover] string channelName) { var ch = await ctx.Guild.CreateVoiceChannelAsync(channelName); await ReplyConfirmLocalizedAsync(strs.createvoich(Format.Bold(ch.Name))); @@ -188,7 +188,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task DelTxtChanl([Leftover] ITextChannel toDelete) + public async Task DelTxtChanl([Leftover] ITextChannel toDelete) { await toDelete.DeleteAsync(); await ReplyConfirmLocalizedAsync(strs.deltextchan(Format.Bold(toDelete.Name))); @@ -198,9 +198,9 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task CreaTxtChanl([Leftover] string channelName) + public async Task CreaTxtChanl([Leftover] string channelName) { - var txtCh = await ctx.Guild.CreateTextChannelAsync(channelName); + var txtCh = await ctx.Guild.CreateTextChannelAsync(channelName); await ReplyConfirmLocalizedAsync(strs.createtextchan(Format.Bold(txtCh.Name))); } @@ -208,7 +208,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task SetTopic([Leftover] string topic = null) + public async Task SetTopic([Leftover] string topic = null) { var channel = (ITextChannel)ctx.Channel; topic ??= ""; @@ -220,7 +220,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task SetChanlName([Leftover] string name) + public async Task SetChanlName([Leftover] string name) { var channel = (ITextChannel)ctx.Channel; await channel.ModifyAsync(c => c.Name = name); @@ -231,7 +231,7 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageChannels)] [BotPerm(GuildPerm.ManageChannels)] - public async partial Task NsfwToggle() + public async Task NsfwToggle() { var channel = (ITextChannel)ctx.Channel; var isEnabled = channel.IsNsfw; @@ -248,13 +248,13 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(ChannelPerm.ManageMessages)] [Priority(0)] - public partial Task Edit(ulong messageId, [Leftover] string text) + public Task Edit(ulong messageId, [Leftover] string text) => Edit((ITextChannel)ctx.Channel, messageId, text); [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task Edit(ITextChannel channel, ulong messageId, [Leftover] string text) + public async Task Edit(ITextChannel channel, ulong messageId, [Leftover] string text) { var userPerms = ((SocketGuildUser)ctx.User).GetPermissions(channel); var botPerms = ((SocketGuild)ctx.Guild).CurrentUser.GetPermissions(channel); @@ -277,12 +277,12 @@ public partial class Administration : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(ChannelPerm.ManageMessages)] [BotPerm(ChannelPerm.ManageMessages)] - public partial Task Delete(ulong messageId, StoopidTime time = null) + public Task Delete(ulong messageId, StoopidTime time = null) => Delete((ITextChannel)ctx.Channel, messageId, time); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Delete(ITextChannel channel, ulong messageId, StoopidTime time = null) + public async Task Delete(ITextChannel channel, ulong messageId, StoopidTime time = null) => await InternalMessageAction(channel, messageId, time, msg => msg.DeleteAsync()); private async Task InternalMessageAction( diff --git a/src/NadekoBot/Modules/Administration/AdministrationService.cs b/src/NadekoBot/Modules/Administration/AdministrationService.cs index 371bd0b07..589708619 100644 --- a/src/NadekoBot/Modules/Administration/AdministrationService.cs +++ b/src/NadekoBot/Modules/Administration/AdministrationService.cs @@ -42,11 +42,11 @@ public class AdministrationService : INService private Task DelMsgOnCmd_Handler(IUserMessage msg, CommandInfo cmd) { + if (msg.Channel is not ITextChannel channel) + return Task.CompletedTask; + _ = Task.Run(async () => { - if (msg.Channel is not SocketTextChannel channel) - return; - //wat ?! if (DeleteMessagesOnCommandChannels.TryGetValue(channel.Id, out var state)) { diff --git a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs b/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs index a86a2f034..3fba8c5cb 100644 --- a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs @@ -13,7 +13,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task AutoAssignRole([Leftover] IRole role) + public async Task AutoAssignRole([Leftover] IRole role) { var guser = (IGuildUser)ctx.User; if (role.Id == ctx.Guild.EveryoneRole.Id) @@ -39,7 +39,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task AutoAssignRole() + public async Task AutoAssignRole() { if (!_service.TryGetRoles(ctx.Guild.Id, out var roles)) { diff --git a/src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommands.cs b/src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommands.cs index 264010718..cc6eee67b 100644 --- a/src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommands.cs +++ b/src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommands.cs @@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Administration [Cmd] [OwnerOnly] - public partial Task SqlSelect([Leftover] string sql) + public Task SqlSelect([Leftover] string sql) { var result = _service.SelectSql(sql); @@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Administration [Cmd] [OwnerOnly] - public async partial Task SqlExec([Leftover] string sql) + public async Task SqlExec([Leftover] string sql) { try { @@ -78,37 +78,37 @@ namespace NadekoBot.Modules.Administration [Cmd] [OwnerOnly] - public partial Task DeleteWaifus() + public Task DeleteWaifus() => ConfirmActionInternalAsync("Delete Waifus", () => _service.DeleteWaifus()); [Cmd] [OwnerOnly] - public async partial Task DeleteWaifu(IUser user) + public async Task DeleteWaifu(IUser user) => await DeleteWaifu(user.Id); [Cmd] [OwnerOnly] - public partial Task DeleteWaifu(ulong userId) + public Task DeleteWaifu(ulong userId) => ConfirmActionInternalAsync($"Delete Waifu {userId}", () => _service.DeleteWaifu(userId)); [Cmd] [OwnerOnly] - public partial Task DeleteCurrency() + public Task DeleteCurrency() => ConfirmActionInternalAsync("Delete Currency", () => _service.DeleteCurrency()); [Cmd] [OwnerOnly] - public partial Task DeletePlaylists() + public Task DeletePlaylists() => ConfirmActionInternalAsync("Delete Playlists", () => _service.DeletePlaylists()); [Cmd] [OwnerOnly] - public partial Task DeleteXp() + public Task DeleteXp() => ConfirmActionInternalAsync("Delete Xp", () => _service.DeleteXp()); [Cmd] [OwnerOnly] - public async partial Task PurgeUser(ulong userId) + public async Task PurgeUser(ulong userId) { var embed = _eb.Create() .WithDescription(GetText(strs.purge_user_confirm(Format.Bold(userId.ToString())))); @@ -122,7 +122,7 @@ namespace NadekoBot.Modules.Administration [Cmd] [OwnerOnly] - public partial Task PurgeUser([Leftover] IUser user) + public Task PurgeUser([Leftover] IUser user) => PurgeUser(user.Id); } } diff --git a/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs b/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs index 1b7060440..848c3f3a5 100644 --- a/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs +++ b/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs @@ -12,7 +12,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.MoveMembers)] - public async partial Task GameVoiceChannel() + public async Task GameVoiceChannel() { var vch = ((IGuildUser)ctx.User).VoiceChannel; diff --git a/src/NadekoBot/Modules/Administration/GreetBye/GreetCommands.cs b/src/NadekoBot/Modules/Administration/GreetBye/GreetCommands.cs index 2055a746b..901b97b2d 100644 --- a/src/NadekoBot/Modules/Administration/GreetBye/GreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/GreetBye/GreetCommands.cs @@ -8,7 +8,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task Boost() + public async Task Boost() { var enabled = await _service.ToggleBoost(ctx.Guild.Id, ctx.Channel.Id); @@ -21,7 +21,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task BoostDel(int timer = 30) + public async Task BoostDel(int timer = 30) { if (timer is < 0 or > 600) return; @@ -37,7 +37,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task BoostMsg([Leftover] string? text = null) + public async Task BoostMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { @@ -56,7 +56,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task GreetDel(int timer = 30) + public async Task GreetDel(int timer = 30) { if (timer is < 0 or > 600) return; @@ -72,7 +72,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task Greet() + public async Task Greet() { var enabled = await _service.SetGreet(ctx.Guild.Id, ctx.Channel.Id); @@ -85,7 +85,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task GreetMsg([Leftover] string? text = null) + public async Task GreetMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { @@ -105,7 +105,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task GreetDm() + public async Task GreetDm() { var enabled = await _service.SetGreetDm(ctx.Guild.Id); @@ -118,7 +118,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task GreetDmMsg([Leftover] string? text = null) + public async Task GreetDmMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { @@ -137,7 +137,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task Bye() + public async Task Bye() { var enabled = await _service.SetBye(ctx.Guild.Id, ctx.Channel.Id); @@ -150,7 +150,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task ByeMsg([Leftover] string? text = null) + public async Task ByeMsg([Leftover] string? text = null) { if (string.IsNullOrWhiteSpace(text)) { @@ -169,7 +169,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] - public async partial Task ByeDel(int timer = 30) + public async Task ByeDel(int timer = 30) { await _service.SetByeDel(ctx.Guild.Id, timer); @@ -184,7 +184,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] [Ratelimit(5)] - public async partial Task ByeTest([Leftover] IGuildUser? user = null) + public async Task ByeTest([Leftover] IGuildUser? user = null) { user ??= (IGuildUser)ctx.User; @@ -198,7 +198,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] [Ratelimit(5)] - public async partial Task GreetTest([Leftover] IGuildUser? user = null) + public async Task GreetTest([Leftover] IGuildUser? user = null) { user ??= (IGuildUser)ctx.User; @@ -212,7 +212,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageGuild)] [Ratelimit(5)] - public async partial Task GreetDmTest([Leftover] IGuildUser? user = null) + public async Task GreetDmTest([Leftover] IGuildUser? user = null) { user ??= (IGuildUser)ctx.User; diff --git a/src/NadekoBot/Modules/Administration/LocalizationCommands.cs b/src/NadekoBot/Modules/Administration/LocalizationCommands.cs index 2048529cb..8890811de 100644 --- a/src/NadekoBot/Modules/Administration/LocalizationCommands.cs +++ b/src/NadekoBot/Modules/Administration/LocalizationCommands.cs @@ -41,7 +41,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task LanguageSet() + public async Task LanguageSet() => await ReplyConfirmLocalizedAsync(strs.lang_set_show(Format.Bold(Culture.ToString()), Format.Bold(Culture.NativeName))); @@ -49,7 +49,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(1)] - public async partial Task LanguageSet(string name) + public async Task LanguageSet(string name) { try { @@ -74,7 +74,7 @@ public partial class Administration } [Cmd] - public async partial Task LanguageSetDefault() + public async Task LanguageSetDefault() { var cul = _localization.DefaultCultureInfo; await ReplyErrorLocalizedAsync(strs.lang_set_bot_show(cul, cul.NativeName)); @@ -82,7 +82,7 @@ public partial class Administration [Cmd] [OwnerOnly] - public async partial Task LanguageSetDefault(string name) + public async Task LanguageSetDefault(string name) { try { @@ -108,7 +108,7 @@ public partial class Administration } [Cmd] - public async partial Task LanguagesList() + public async Task LanguagesList() => await ctx.Channel.EmbedAsync(_eb.Create() .WithOkColor() .WithTitle(GetText(strs.lang_list)) diff --git a/src/NadekoBot/Modules/Administration/Mute/MuteCommands.cs b/src/NadekoBot/Modules/Administration/Mute/MuteCommands.cs index 53646475e..1831c5934 100644 --- a/src/NadekoBot/Modules/Administration/Mute/MuteCommands.cs +++ b/src/NadekoBot/Modules/Administration/Mute/MuteCommands.cs @@ -26,7 +26,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] - public async partial Task MuteRole([Leftover] IRole role = null) + public async Task MuteRole([Leftover] IRole role = null) { if (role is null) { @@ -51,7 +51,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles | GuildPerm.MuteMembers)] [Priority(0)] - public async partial Task Mute(IGuildUser target, [Leftover] string reason = "") + public async Task Mute(IGuildUser target, [Leftover] string reason = "") { try { @@ -72,7 +72,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles | GuildPerm.MuteMembers)] [Priority(1)] - public async partial Task Mute(StoopidTime time, IGuildUser user, [Leftover] string reason = "") + public async Task Mute(StoopidTime time, IGuildUser user, [Leftover] string reason = "") { if (time.Time < TimeSpan.FromMinutes(1) || time.Time > TimeSpan.FromDays(49)) return; @@ -95,7 +95,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles | GuildPerm.MuteMembers)] - public async partial Task Unmute(IGuildUser user, [Leftover] string reason = "") + public async Task Unmute(IGuildUser user, [Leftover] string reason = "") { try { @@ -112,7 +112,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [Priority(0)] - public async partial Task ChatMute(IGuildUser user, [Leftover] string reason = "") + public async Task ChatMute(IGuildUser user, [Leftover] string reason = "") { try { @@ -133,7 +133,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [Priority(1)] - public async partial Task ChatMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "") + public async Task ChatMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "") { if (time.Time < TimeSpan.FromMinutes(1) || time.Time > TimeSpan.FromDays(49)) return; @@ -156,7 +156,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] - public async partial Task ChatUnmute(IGuildUser user, [Leftover] string reason = "") + public async Task ChatUnmute(IGuildUser user, [Leftover] string reason = "") { try { @@ -173,7 +173,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.MuteMembers)] [Priority(0)] - public async partial Task VoiceMute(IGuildUser user, [Leftover] string reason = "") + public async Task VoiceMute(IGuildUser user, [Leftover] string reason = "") { try { @@ -193,7 +193,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.MuteMembers)] [Priority(1)] - public async partial Task VoiceMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "") + public async Task VoiceMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "") { if (time.Time < TimeSpan.FromMinutes(1) || time.Time > TimeSpan.FromDays(49)) return; @@ -215,7 +215,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.MuteMembers)] - public async partial Task VoiceUnmute(IGuildUser user, [Leftover] string reason = "") + public async Task VoiceUnmute(IGuildUser user, [Leftover] string reason = "") { try { diff --git a/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideCommands.cs b/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideCommands.cs index 2f94218f2..ec764550d 100644 --- a/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideCommands.cs +++ b/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideCommands.cs @@ -15,7 +15,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task DiscordPermOverride(CommandOrExprInfo cmd, params GuildPerm[] perms) + public async Task DiscordPermOverride(CommandOrExprInfo cmd, params GuildPerm[] perms) { if (perms is null || perms.Length == 0) { @@ -34,7 +34,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task DiscordPermOverrideReset() + public async Task DiscordPermOverrideReset() { var result = await PromptUserConfirmAsync(_eb.Create() .WithOkColor() @@ -51,7 +51,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task DiscordPermOverrideList(int page = 1) + public async Task DiscordPermOverrideList(int page = 1) { if (--page < 0) return; diff --git a/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs b/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs index 61e8b0750..ac9878dde 100644 --- a/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs +++ b/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs @@ -10,7 +10,7 @@ public partial class Administration { [Cmd] [OwnerOnly] - public async partial Task RotatePlaying() + public async Task RotatePlaying() { if (_service.ToggleRotatePlaying()) await ReplyConfirmLocalizedAsync(strs.ropl_enabled); @@ -20,7 +20,7 @@ public partial class Administration [Cmd] [OwnerOnly] - public async partial Task AddPlaying(ActivityType t, [Leftover] string status) + public async Task AddPlaying(ActivityType t, [Leftover] string status) { await _service.AddPlaying(t, status); @@ -29,7 +29,7 @@ public partial class Administration [Cmd] [OwnerOnly] - public async partial Task ListPlaying() + public async Task ListPlaying() { var statuses = _service.GetRotatingStatuses(); @@ -45,7 +45,7 @@ public partial class Administration [Cmd] [OwnerOnly] - public async partial Task RemovePlaying(int index) + public async Task RemovePlaying(int index) { index -= 1; diff --git a/src/NadekoBot/Modules/Administration/Prefix/PrefixCommands.cs b/src/NadekoBot/Modules/Administration/Prefix/PrefixCommands.cs index 2b175cd00..b91753f9a 100644 --- a/src/NadekoBot/Modules/Administration/Prefix/PrefixCommands.cs +++ b/src/NadekoBot/Modules/Administration/Prefix/PrefixCommands.cs @@ -13,21 +13,21 @@ public partial class Administration [Cmd] [Priority(1)] - public async partial Task Prefix() + public async Task Prefix() => await ReplyConfirmLocalizedAsync(strs.prefix_current(Format.Code(_cmdHandler.GetPrefix(ctx.Guild)))); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(0)] - public partial Task Prefix(Set _, [Leftover] string newPrefix) + public Task Prefix(Set _, [Leftover] string newPrefix) => Prefix(newPrefix); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(0)] - public async partial Task Prefix([Leftover] string toSet) + public async Task Prefix([Leftover] string toSet) { if (string.IsNullOrWhiteSpace(prefix)) return; @@ -40,7 +40,7 @@ public partial class Administration [Cmd] [OwnerOnly] - public async partial Task DefPrefix([Leftover] string toSet = null) + public async Task DefPrefix([Leftover] string toSet = null) { if (string.IsNullOrWhiteSpace(toSet)) { diff --git a/src/NadekoBot/Modules/Administration/Protection/ProtectionCommands.cs b/src/NadekoBot/Modules/Administration/Protection/ProtectionCommands.cs index 2642aefeb..9e244bc89 100644 --- a/src/NadekoBot/Modules/Administration/Protection/ProtectionCommands.cs +++ b/src/NadekoBot/Modules/Administration/Protection/ProtectionCommands.cs @@ -13,7 +13,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task AntiAlt() + public async Task AntiAlt() { if (await _service.TryStopAntiAlt(ctx.Guild.Id)) { @@ -27,7 +27,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task AntiAlt( + public async Task AntiAlt( StoopidTime minAge, PunishmentAction action, [Leftover] StoopidTime punishTime = null) @@ -49,7 +49,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task AntiAlt(StoopidTime minAge, PunishmentAction action, [Leftover] IRole role) + public async Task AntiAlt(StoopidTime minAge, PunishmentAction action, [Leftover] IRole role) { var minAgeMinutes = (int)minAge.Time.TotalMinutes; @@ -64,7 +64,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public partial Task AntiRaid() + public Task AntiRaid() { if (_service.TryStopAntiRaid(ctx.Guild.Id)) return ReplyConfirmLocalizedAsync(strs.prot_disable("Anti-Raid")); @@ -75,7 +75,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(1)] - public partial Task AntiRaid( + public Task AntiRaid( int userThreshold, int seconds, PunishmentAction action, @@ -86,7 +86,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(2)] - public partial Task AntiRaid(int userThreshold, int seconds, PunishmentAction action) + public Task AntiRaid(int userThreshold, int seconds, PunishmentAction action) => InternalAntiRaid(userThreshold, seconds, action); private async Task InternalAntiRaid( @@ -135,7 +135,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public partial Task AntiSpam() + public Task AntiSpam() { if (_service.TryStopAntiSpam(ctx.Guild.Id)) return ReplyConfirmLocalizedAsync(strs.prot_disable("Anti-Spam")); @@ -146,7 +146,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(0)] - public partial Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] IRole role) + public Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] IRole role) { if (action != PunishmentAction.AddRole) return Task.CompletedTask; @@ -158,14 +158,14 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(1)] - public partial Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] StoopidTime punishTime) + public Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] StoopidTime punishTime) => InternalAntiSpam(messageCount, action, punishTime); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(2)] - public partial Task AntiSpam(int messageCount, PunishmentAction action) + public Task AntiSpam(int messageCount, PunishmentAction action) => InternalAntiSpam(messageCount, action); private async Task InternalAntiSpam( @@ -196,7 +196,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task AntispamIgnore() + public async Task AntispamIgnore() { var added = await _service.AntiSpamIgnoreAsync(ctx.Guild.Id, ctx.Channel.Id); @@ -214,7 +214,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task AntiList() + public async Task AntiList() { var (spam, raid, alt) = _service.GetAntiStats(ctx.Guild.Id); diff --git a/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs b/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs index a864fd8fe..4468dd6f0 100644 --- a/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs +++ b/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs @@ -13,7 +13,7 @@ public partial class Administration //delets her own messages, no perm required [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Prune(string parameter = null) + public async Task Prune(string parameter = null) { var user = await ctx.Guild.GetCurrentUserAsync(); @@ -30,7 +30,7 @@ public partial class Administration [UserPerm(ChannelPerm.ManageMessages)] [BotPerm(ChannelPerm.ManageMessages)] [Priority(1)] - public async partial Task Prune(int count, string parameter = null) + public async Task Prune(int count, string parameter = null) { count++; if (count < 1) @@ -50,7 +50,7 @@ public partial class Administration [UserPerm(ChannelPerm.ManageMessages)] [BotPerm(ChannelPerm.ManageMessages)] [Priority(0)] - public partial Task Prune(IGuildUser user, int count = 100, string parameter = null) + public Task Prune(IGuildUser user, int count = 100, string parameter = null) => Prune(user.Id, count, parameter); //prune userid [x] @@ -59,7 +59,7 @@ public partial class Administration [UserPerm(ChannelPerm.ManageMessages)] [BotPerm(ChannelPerm.ManageMessages)] [Priority(0)] - public async partial Task Prune(ulong userId, int count = 100, string parameter = null) + public async Task Prune(ulong userId, int count = 100, string parameter = null) { if (userId == ctx.User.Id) count++; diff --git a/src/NadekoBot/Modules/Administration/Role/ReactionRoleCommands.cs b/src/NadekoBot/Modules/Administration/Role/ReactionRoleCommands.cs index e6c58a6b4..942f5d257 100644 --- a/src/NadekoBot/Modules/Administration/Role/ReactionRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/Role/ReactionRoleCommands.cs @@ -17,7 +17,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task ReactionRoleAdd( + public async Task ReactionRoleAdd( ulong messageId, string emoteStr, IRole role, @@ -67,7 +67,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task ReactionRolesList() + public async Task ReactionRolesList() { var reros = await _rero.GetReactionRolesAsync(ctx.Guild.Id); @@ -109,7 +109,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task ReactionRolesRemove(ulong messageId) + public async Task ReactionRolesRemove(ulong messageId) { var succ = await _rero.RemoveReactionRoles(ctx.Guild.Id, messageId); if (succ) @@ -122,7 +122,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task ReactionRolesDeleteAll() + public async Task ReactionRolesDeleteAll() { await _rero.RemoveAllReactionRoles(ctx.Guild.Id); await ctx.OkAsync(); @@ -133,7 +133,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [Ratelimit(60)] - public async partial Task ReactionRolesTransfer(ulong fromMessageId, ulong toMessageId) + public async Task ReactionRolesTransfer(ulong fromMessageId, ulong toMessageId) { var msg = await ctx.Channel.GetMessageAsync(toMessageId); diff --git a/src/NadekoBot/Modules/Administration/Role/RoleCommands.cs b/src/NadekoBot/Modules/Administration/Role/RoleCommands.cs index 6da732203..34296404a 100644 --- a/src/NadekoBot/Modules/Administration/Role/RoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/Role/RoleCommands.cs @@ -25,7 +25,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task SetRole(IGuildUser targetUser, [Leftover] IRole roleToAdd) + public async Task SetRole(IGuildUser targetUser, [Leftover] IRole roleToAdd) { var runnerUser = (IGuildUser)ctx.User; var runnerMaxRolePosition = runnerUser.GetRoles().Max(x => x.Position); @@ -49,7 +49,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task RemoveRole(IGuildUser targetUser, [Leftover] IRole roleToRemove) + public async Task RemoveRole(IGuildUser targetUser, [Leftover] IRole roleToRemove) { var runnerUser = (IGuildUser)ctx.User; if (ctx.User.Id != runnerUser.Guild.OwnerId @@ -71,7 +71,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task RenameRole(IRole roleToEdit, [Leftover] string newname) + public async Task RenameRole(IRole roleToEdit, [Leftover] string newname) { var guser = (IGuildUser)ctx.User; if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= roleToEdit.Position) @@ -97,7 +97,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task RemoveAllRoles([Leftover] IGuildUser user) + public async Task RemoveAllRoles([Leftover] IGuildUser user) { var guser = (IGuildUser)ctx.User; @@ -122,7 +122,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task CreateRole([Leftover] string roleName = null) + public async Task CreateRole([Leftover] string roleName = null) { if (string.IsNullOrWhiteSpace(roleName)) return; @@ -135,7 +135,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task DeleteRole([Leftover] IRole role) + public async Task DeleteRole([Leftover] IRole role) { var guser = (IGuildUser)ctx.User; if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position) @@ -149,7 +149,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task RoleHoist([Leftover] IRole role) + public async Task RoleHoist([Leftover] IRole role) { var newHoisted = !role.IsHoisted; await role.ModifyAsync(r => r.Hoist = newHoisted); @@ -162,7 +162,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task RoleColor([Leftover] IRole role) + public async Task RoleColor([Leftover] IRole role) => await SendConfirmAsync("Role Color", role.Color.RawValue.ToString("x6")); [Cmd] @@ -170,7 +170,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [Priority(0)] - public async partial Task RoleColor(Color color, [Leftover] IRole role) + public async Task RoleColor(Color color, [Leftover] IRole role) { try { diff --git a/src/NadekoBot/Modules/Administration/Self/SelfCommands.cs b/src/NadekoBot/Modules/Administration/Self/SelfCommands.cs index 90396729e..bd8f8d974 100644 --- a/src/NadekoBot/Modules/Administration/Self/SelfCommands.cs +++ b/src/NadekoBot/Modules/Administration/Self/SelfCommands.cs @@ -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(); diff --git a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs b/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs index 368680854..c54f37944 100644 --- a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs @@ -13,7 +13,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [BotPerm(GuildPerm.ManageMessages)] - public async partial Task AdSarm() + public async Task AdSarm() { var newVal = _service.ToggleAdSarm(ctx.Guild.Id); @@ -28,7 +28,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [Priority(1)] - public partial Task Asar([Leftover] IRole role) + public Task Asar([Leftover] IRole role) => Asar(0, role); [Cmd] @@ -36,7 +36,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [Priority(0)] - public async partial Task Asar(int group, [Leftover] IRole role) + public async Task Asar(int group, [Leftover] IRole role) { var guser = (IGuildUser)ctx.User; if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position) @@ -58,7 +58,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [Priority(0)] - public async partial Task Sargn(int group, [Leftover] string name = null) + public async Task Sargn(int group, [Leftover] string name = null) { var set = await _service.SetNameAsync(ctx.Guild.Id, group, name); @@ -74,7 +74,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] - public async partial Task Rsar([Leftover] IRole role) + public async Task Rsar([Leftover] IRole role) { var guser = (IGuildUser)ctx.User; if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position) @@ -89,7 +89,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Lsar(int page = 1) + public async Task Lsar(int page = 1) { if (--page < 0) return; @@ -149,7 +149,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task Togglexclsar() + public async Task Togglexclsar() { var areExclusive = _service.ToggleEsar(ctx.Guild.Id); if (areExclusive) @@ -162,7 +162,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task RoleLevelReq(int level, [Leftover] IRole role) + public async Task RoleLevelReq(int level, [Leftover] IRole role) { if (level < 0) return; @@ -181,7 +181,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Iam([Leftover] IRole role) + public async Task Iam([Leftover] IRole role) { var guildUser = (IGuildUser)ctx.User; @@ -208,7 +208,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Iamnot([Leftover] IRole role) + public async Task Iamnot([Leftover] IRole role) { var guildUser = (IGuildUser)ctx.User; diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs index 7a5f57110..1ddba679c 100644 --- a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs +++ b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs @@ -13,7 +13,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [OwnerOnly] - public async partial Task LogServer(PermissionAction action) + public async Task LogServer(PermissionAction action) { await _service.LogServer(ctx.Guild.Id, ctx.Channel.Id, action.Value); if (action.Value) @@ -26,7 +26,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [OwnerOnly] - public async partial Task LogIgnore() + public async Task LogIgnore() { var settings = _service.GetGuildLogSettings(ctx.Guild.Id); @@ -53,7 +53,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [OwnerOnly] - public async partial Task LogIgnore([Leftover] ITextChannel target) + public async Task LogIgnore([Leftover] ITextChannel target) { var removed = _service.LogIgnore(ctx.Guild.Id, target.Id, IgnoredItemType.Channel); @@ -73,7 +73,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [OwnerOnly] - public async partial Task LogIgnore([Leftover] IUser target) + public async Task LogIgnore([Leftover] IUser target) { var removed = _service.LogIgnore(ctx.Guild.Id, target.Id, IgnoredItemType.User); @@ -93,7 +93,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [OwnerOnly] - public async partial Task LogEvents() + public async Task LogEvents() { var logSetting = _service.GetGuildLogSettings(ctx.Guild.Id); var str = string.Join("\n", @@ -152,7 +152,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [OwnerOnly] - public async partial Task Log(LogType type) + public async Task Log(LogType type) { var val = _service.Log(ctx.Guild.Id, ctx.Channel.Id, type); diff --git a/src/NadekoBot/Modules/Administration/Timezone/TimeZoneCommands.cs b/src/NadekoBot/Modules/Administration/Timezone/TimeZoneCommands.cs index 09811de83..448bc1b7d 100644 --- a/src/NadekoBot/Modules/Administration/Timezone/TimeZoneCommands.cs +++ b/src/NadekoBot/Modules/Administration/Timezone/TimeZoneCommands.cs @@ -10,7 +10,7 @@ public partial class Administration { [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Timezones(int page = 1) + public async Task Timezones(int page = 1) { page--; @@ -48,13 +48,13 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Timezone() + public async Task Timezone() => await ReplyConfirmLocalizedAsync(strs.timezone_guild(_service.GetTimeZoneOrUtc(ctx.Guild.Id))); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task Timezone([Leftover] string id) + public async Task Timezone([Leftover] string id) { TimeZoneInfo tz; try { tz = TimeZoneInfo.FindSystemTimeZoneById(id); } diff --git a/src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs b/src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs index 0edd34d17..72153264e 100644 --- a/src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs +++ b/src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs @@ -51,13 +51,13 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public partial Task Warn(IGuildUser user, [Leftover] string reason = null) + public Task Warn(IGuildUser user, [Leftover] string reason = null) => Warn(1, user, reason); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public async partial Task Warn(int weight, IGuildUser user, [Leftover] string reason = null) + public async Task Warn(int weight, IGuildUser user, [Leftover] string reason = null) { if (weight <= 0) return; @@ -116,7 +116,7 @@ public partial class Administration [UserPerm(GuildPerm.Administrator)] [NadekoOptions(typeof(WarnExpireOptions))] [Priority(1)] - public async partial Task WarnExpire() + public async Task WarnExpire() { var expireDays = await _service.GetWarnExpire(ctx.Guild.Id); @@ -131,7 +131,7 @@ public partial class Administration [UserPerm(GuildPerm.Administrator)] [NadekoOptions(typeof(WarnExpireOptions))] [Priority(2)] - public async partial Task WarnExpire(int days, params string[] args) + public async Task WarnExpire(int days, params string[] args) { if (days is < 0 or > 366) return; @@ -157,7 +157,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [Priority(2)] - public partial Task Warnlog(int page, [Leftover] IGuildUser user = null) + public Task Warnlog(int page, [Leftover] IGuildUser user = null) { user ??= (IGuildUser)ctx.User; @@ -167,7 +167,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [Priority(3)] - public partial Task Warnlog(IGuildUser user = null) + public Task Warnlog(IGuildUser user = null) { user ??= (IGuildUser)ctx.User; @@ -180,14 +180,14 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [Priority(0)] - public partial Task Warnlog(int page, ulong userId) + public Task Warnlog(int page, ulong userId) => InternalWarnlog(userId, page - 1); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [Priority(1)] - public partial Task Warnlog(ulong userId) + public Task Warnlog(ulong userId) => InternalWarnlog(userId, 0); private async Task InternalWarnlog(ulong userId, int inputPage) @@ -241,7 +241,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public async partial Task WarnlogAll(int page = 1) + public async Task WarnlogAll(int page = 1) { if (--page < 0) return; @@ -275,13 +275,13 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public partial Task Warnclear(IGuildUser user, int index = 0) + public Task Warnclear(IGuildUser user, int index = 0) => Warnclear(user.Id, index); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public async partial Task Warnclear(ulong userId, int index = 0) + public async Task Warnclear(ulong userId, int index = 0) { if (index < 0) return; @@ -302,7 +302,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [Priority(1)] - public async partial Task WarnPunish( + public async Task WarnPunish( int number, AddRole _, IRole role, @@ -338,7 +338,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public async partial Task WarnPunish(int number, PunishmentAction punish, StoopidTime time = null) + public async Task WarnPunish(int number, PunishmentAction punish, StoopidTime time = null) { // this should never happen. Addrole has its own method with higher priority // also disallow warn punishment for getting warned @@ -366,7 +366,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] - public async partial Task WarnPunish(int number) + public async Task WarnPunish(int number) { if (!_service.WarnPunishRemove(ctx.Guild.Id, number)) return; @@ -376,7 +376,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task WarnPunishList() + public async Task WarnPunishList() { var ps = _service.WarnPunishList(ctx.Guild.Id); @@ -398,7 +398,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [Priority(1)] - public async partial Task Ban(StoopidTime time, IUser user, [Leftover] string msg = null) + public async Task Ban(StoopidTime time, IUser user, [Leftover] string msg = null) { if (time.Time > TimeSpan.FromDays(49)) return; @@ -446,7 +446,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [Priority(0)] - public async partial Task Ban(ulong userId, [Leftover] string msg = null) + public async Task Ban(ulong userId, [Leftover] string msg = null) { var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId); if (user is null) @@ -467,7 +467,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [Priority(2)] - public async partial Task Ban(IGuildUser user, [Leftover] string msg = null) + public async Task Ban(IGuildUser user, [Leftover] string msg = null) { if (!await CheckRoleHierarchy(user)) return; @@ -504,7 +504,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] - public async partial Task BanMessage([Leftover] string message = null) + public async Task BanMessage([Leftover] string message = null) { if (message is null) { @@ -527,7 +527,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] - public async partial Task BanMsgReset() + public async Task BanMsgReset() { _service.SetBanTemplate(ctx.Guild.Id, null); await ctx.OkAsync(); @@ -538,7 +538,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [Priority(0)] - public partial Task BanMessageTest([Leftover] string reason = null) + public Task BanMessageTest([Leftover] string reason = null) => InternalBanMessageTest(reason, null); [Cmd] @@ -546,7 +546,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [Priority(1)] - public partial Task BanMessageTest(StoopidTime duration, [Leftover] string reason = null) + public Task BanMessageTest(StoopidTime duration, [Leftover] string reason = null) => InternalBanMessageTest(reason, duration.Time); private async Task InternalBanMessageTest(string reason, TimeSpan? duration) @@ -576,7 +576,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] - public async partial Task Unban([Leftover] string user) + public async Task Unban([Leftover] string user) { var bans = await ctx.Guild.GetBansAsync().FlattenAsync(); @@ -595,7 +595,7 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] - public async partial Task Unban(ulong userId) + public async Task Unban(ulong userId) { var bun = await ctx.Guild.GetBanAsync(userId); @@ -619,14 +619,14 @@ public partial class Administration [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.KickMembers | GuildPerm.ManageMessages)] [BotPerm(GuildPerm.BanMembers)] - public partial Task Softban(IGuildUser user, [Leftover] string msg = null) + public Task Softban(IGuildUser user, [Leftover] string msg = null) => SoftbanInternal(user, msg); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.KickMembers | GuildPerm.ManageMessages)] [BotPerm(GuildPerm.BanMembers)] - public async partial Task Softban(ulong userId, [Leftover] string msg = null) + public async Task Softban(ulong userId, [Leftover] string msg = null) { var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId); if (user is null) @@ -672,7 +672,7 @@ public partial class Administration [UserPerm(GuildPerm.KickMembers)] [BotPerm(GuildPerm.KickMembers)] [Priority(1)] - public partial Task Kick(IGuildUser user, [Leftover] string msg = null) + public Task Kick(IGuildUser user, [Leftover] string msg = null) => KickInternal(user, msg); [Cmd] @@ -680,7 +680,7 @@ public partial class Administration [UserPerm(GuildPerm.KickMembers)] [BotPerm(GuildPerm.KickMembers)] [Priority(0)] - public async partial Task Kick(ulong userId, [Leftover] string msg = null) + public async Task Kick(ulong userId, [Leftover] string msg = null) { var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId); if (user is null) @@ -724,7 +724,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [Ratelimit(30)] - public async partial Task MassBan(params string[] userStrings) + public async Task MassBan(params string[] userStrings) { if (userStrings.Length == 0) return; @@ -800,7 +800,7 @@ public partial class Administration [UserPerm(GuildPerm.BanMembers)] [BotPerm(GuildPerm.BanMembers)] [OwnerOnly] - public async partial Task MassKill([Leftover] string people) + public async Task MassKill([Leftover] string people) { if (string.IsNullOrWhiteSpace(people)) return; diff --git a/src/NadekoBot/Modules/Administration/VcRole/VcRoleCommands.cs b/src/NadekoBot/Modules/Administration/VcRole/VcRoleCommands.cs index 30c82599f..64f22ad19 100644 --- a/src/NadekoBot/Modules/Administration/VcRole/VcRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/VcRole/VcRoleCommands.cs @@ -12,7 +12,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task VcRoleRm(ulong vcId) + public async Task VcRoleRm(ulong vcId) { if (_service.RemoveVcRole(ctx.Guild.Id, vcId)) await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vcId.ToString()))); @@ -24,7 +24,7 @@ public partial class Administration [UserPerm(GuildPerm.ManageRoles)] [BotPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task VcRole([Leftover] IRole role = null) + public async Task VcRole([Leftover] IRole role = null) { var user = (IGuildUser)ctx.User; @@ -50,7 +50,7 @@ public partial class Administration [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task VcRoleList() + public async Task VcRoleList() { var guild = (SocketGuild)ctx.Guild; string text; diff --git a/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs b/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs index e93c7862d..eb263a63e 100644 --- a/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs +++ b/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs @@ -26,7 +26,7 @@ public partial class NadekoExpressions : NadekoModule || (ctx.Guild is not null && ((IGuildUser)ctx.User).GuildPermissions.Administrator); [Cmd] - public async partial Task ExprAdd(string key, [Leftover] string message) + public async Task ExprAdd(string key, [Leftover] string message) { if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key)) return; @@ -49,7 +49,7 @@ public partial class NadekoExpressions : NadekoModule } [Cmd] - public async partial Task ExprEdit(kwum id, [Leftover] string message) + public async Task ExprEdit(kwum id, [Leftover] string message) { var channel = ctx.Channel as ITextChannel; if (string.IsNullOrWhiteSpace(message) || id < 0) @@ -79,7 +79,7 @@ public partial class NadekoExpressions : NadekoModule [Cmd] [Priority(1)] - public async partial Task ExprList(int page = 1) + public async Task ExprList(int page = 1) { if (--page < 0 || page > 999) return; @@ -114,7 +114,7 @@ public partial class NadekoExpressions : NadekoModule } [Cmd] - public async partial Task ExprShow(kwum id) + public async Task ExprShow(kwum id) { var found = _service.GetExpression(ctx.Guild?.Id, id); @@ -133,7 +133,7 @@ public partial class NadekoExpressions : NadekoModule } [Cmd] - public async partial Task ExprDelete(kwum id) + public async Task ExprDelete(kwum id) { if (!AdminInGuildOrOwnerInDm()) { @@ -157,7 +157,7 @@ public partial class NadekoExpressions : NadekoModule } [Cmd] - public async partial Task ExprReact(kwum id, params string[] emojiStrs) + public async Task ExprReact(kwum id, params string[] emojiStrs) { if (!AdminInGuildOrOwnerInDm()) { @@ -211,24 +211,24 @@ public partial class NadekoExpressions : NadekoModule } [Cmd] - public partial Task ExprCa(kwum id) + public Task ExprCa(kwum id) => InternalExprEdit(id, ExprField.ContainsAnywhere); [Cmd] - public partial Task ExprDm(kwum id) + public Task ExprDm(kwum id) => InternalExprEdit(id, ExprField.DmResponse); [Cmd] - public partial Task ExprAd(kwum id) + public Task ExprAd(kwum id) => InternalExprEdit(id, ExprField.AutoDelete); [Cmd] - public partial Task ExprAt(kwum id) + public Task ExprAt(kwum id) => InternalExprEdit(id, ExprField.AllowTarget); [Cmd] [OwnerOnly] - public async partial Task ExprsReload() + public async Task ExprsReload() { await _service.TriggerReloadExpressions(); @@ -265,7 +265,7 @@ public partial class NadekoExpressions : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ExprClear() + public async Task ExprClear() { if (await PromptUserConfirmAsync(_eb.Create() .WithTitle("Expression clear") @@ -277,7 +277,7 @@ public partial class NadekoExpressions : NadekoModule } [Cmd] - public async partial Task ExprsExport() + public async Task ExprsExport() { if (!AdminInGuildOrOwnerInDm()) { @@ -296,7 +296,7 @@ public partial class NadekoExpressions : NadekoModule #if GLOBAL_NADEKO [OwnerOnly] #endif - public async partial Task ExprsImport([Leftover] string input = null) + public async Task ExprsImport([Leftover] string input = null) { if (!AdminInGuildOrOwnerInDm()) { diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs b/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs index 0e9a6d13d..f2a71075a 100644 --- a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs +++ b/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs @@ -35,7 +35,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [NadekoOptionsAttribute(typeof(RaceOptions))] - public partial Task Race(params string[] args) + public Task Race(params string[] args) { var (options, _) = OptionsParser.ParseFrom(new RaceOptions(), args); @@ -135,7 +135,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task JoinRace(ShmartNumber amount = default) + public async Task JoinRace(ShmartNumber amount = default) { if (!await CheckBetOptional(amount)) return; diff --git a/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs b/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs index 4fda56563..e008259b7 100644 --- a/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs @@ -19,7 +19,7 @@ public partial class Gambling } [Cmd] - public async partial Task BankDeposit(ShmartNumber amount) + public async Task BankDeposit(ShmartNumber amount) { if (amount <= 0) return; @@ -35,7 +35,7 @@ public partial class Gambling } [Cmd] - public async partial Task BankWithdraw(ShmartNumber amount) + public async Task BankWithdraw(ShmartNumber amount) { if (amount <= 0) return; @@ -51,7 +51,7 @@ public partial class Gambling } [Cmd] - public async partial Task BankBalance() + public async Task BankBalance() { var bal = await _bank.GetBalanceAsync(ctx.User.Id); diff --git a/src/NadekoBot/Modules/Gambling/BlackJack/BlackJackCommands.cs b/src/NadekoBot/Modules/Gambling/BlackJack/BlackJackCommands.cs index 539cecfa8..f71acdb62 100644 --- a/src/NadekoBot/Modules/Gambling/BlackJack/BlackJackCommands.cs +++ b/src/NadekoBot/Modules/Gambling/BlackJack/BlackJackCommands.cs @@ -30,7 +30,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task BlackJack(ShmartNumber amount) + public async Task BlackJack(ShmartNumber amount) { if (!await CheckBetMandatory(amount)) return; @@ -149,17 +149,17 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Hit() + public Task Hit() => InternalBlackJack(BjAction.Hit); [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Stand() + public Task Stand() => InternalBlackJack(BjAction.Stand); [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Double() + public Task Double() => InternalBlackJack(BjAction.Double); private async Task InternalBlackJack(BjAction a) diff --git a/src/NadekoBot/Modules/Gambling/Connect4/Connect4Commands.cs b/src/NadekoBot/Modules/Gambling/Connect4/Connect4Commands.cs index 5c3d3e50e..c1e9aeea2 100644 --- a/src/NadekoBot/Modules/Gambling/Connect4/Connect4Commands.cs +++ b/src/NadekoBot/Modules/Gambling/Connect4/Connect4Commands.cs @@ -45,7 +45,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [NadekoOptionsAttribute(typeof(Connect4Game.Options))] - public async partial Task Connect4(params string[] args) + public async Task Connect4(params string[] args) { var (options, _) = OptionsParser.ParseFrom(new Connect4Game.Options(), args); if (!await CheckBetOptional(options.Bet)) diff --git a/src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs b/src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs index 708946b90..c49fe3930 100644 --- a/src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs +++ b/src/NadekoBot/Modules/Gambling/DiceRoll/DiceRollCommands.cs @@ -23,7 +23,7 @@ public partial class Gambling => _images = images; [Cmd] - public async partial Task Roll() + public async Task Roll() { var rng = new NadekoRandom(); var gen = rng.Next(1, 101); @@ -51,23 +51,23 @@ public partial class Gambling [Cmd] [Priority(1)] - public async partial Task Roll(int num) + public async Task Roll(int num) => await InternalRoll(num, true); [Cmd] [Priority(1)] - public async partial Task Rolluo(int num = 1) + public async Task Rolluo(int num = 1) => await InternalRoll(num, false); [Cmd] [Priority(0)] - public async partial Task Roll(string arg) + public async Task Roll(string arg) => await InternallDndRoll(arg, true); [Cmd] [Priority(0)] - public async partial Task Rolluo(string arg) + public async Task Rolluo(string arg) => await InternallDndRoll(arg, false); private async Task InternalRoll(int num, bool ordered) @@ -186,7 +186,7 @@ public partial class Gambling } [Cmd] - public async partial Task NRoll([Leftover] string range) + public async Task NRoll([Leftover] string range) { int rolled; if (range.Contains("-")) @@ -213,12 +213,12 @@ public partial class Gambling if (num == 10) { - using var imgOne = Image.Load(await _images.GetDiceAsync(1)); - using var imgZero = Image.Load(await _images.GetDiceAsync(0)); + using var imgOne = Image.Load(await _images.GetDiceAsync(1)); + using var imgZero = Image.Load(await _images.GetDiceAsync(0)); return new[] { imgOne, imgZero }.Merge(); } - return Image.Load(await _images.GetDiceAsync(num)); + return Image.Load(await _images.GetDiceAsync(num)); } } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Gambling/Draw/DrawCommands.cs b/src/NadekoBot/Modules/Gambling/Draw/DrawCommands.cs index fe154a20a..f3747e0e7 100644 --- a/src/NadekoBot/Modules/Gambling/Draw/DrawCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Draw/DrawCommands.cs @@ -81,12 +81,12 @@ public partial class Gambling { var cardName = currentCard.ToString().ToLowerInvariant().Replace(' ', '_'); var cardBytes = await File.ReadAllBytesAsync($"data/images/cards/{cardName}.jpg"); - return Image.Load(cardBytes); + return Image.Load(cardBytes); } [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Draw(int num = 1) + public async Task Draw(int num = 1) { if (num < 1) return; @@ -98,7 +98,7 @@ public partial class Gambling } [Cmd] - public async partial Task DrawNew(int num = 1) + public async Task DrawNew(int num = 1) { if (num < 1) return; @@ -111,7 +111,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task DeckShuffle() + public async Task DeckShuffle() { //var channel = (ITextChannel)ctx.Channel; @@ -128,12 +128,12 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public partial Task BetDraw(ShmartNumber amount, InputValueGuess val, InputColorGuess? col = null) + public Task BetDraw(ShmartNumber amount, InputValueGuess val, InputColorGuess? col = null) => BetDrawInternal(amount, val, col); [Cmd] [RequireContext(ContextType.Guild)] - public partial Task BetDraw(ShmartNumber amount, InputColorGuess col, InputValueGuess? val = null) + public Task BetDraw(ShmartNumber amount, InputColorGuess col, InputValueGuess? val = null) => BetDrawInternal(amount, val, col); public async Task BetDrawInternal(long amount, InputValueGuess? val, InputColorGuess? col) diff --git a/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsCommands.cs b/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsCommands.cs index e2b315873..d7b7496a8 100644 --- a/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsCommands.cs @@ -20,7 +20,7 @@ public partial class Gambling [RequireContext(ContextType.Guild)] [NadekoOptionsAttribute(typeof(EventOptions))] [OwnerOnly] - public async partial Task EventStart(CurrencyEvent.Type ev, params string[] options) + public async Task EventStart(CurrencyEvent.Type ev, params string[] options) { var (opts, _) = OptionsParser.ParseFrom(new EventOptions(), options); if (!await _service.TryCreateEventAsync(ctx.Guild.Id, ctx.Channel.Id, ev, opts, GetEmbed)) diff --git a/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsService.cs b/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsService.cs index b1e47e43a..d30ae9cb8 100644 --- a/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsService.cs +++ b/src/NadekoBot/Modules/Gambling/Events/CurrencyEventsService.cs @@ -13,7 +13,7 @@ public class CurrencyEventsService : INService private readonly ConcurrentDictionary _events = new(); - +// todo fix xp freeze public CurrencyEventsService(DiscordSocketClient client, ICurrencyService cs, GamblingConfigService configService) { _client = client; @@ -29,7 +29,7 @@ public class CurrencyEventsService : INService Func embed) { var g = _client.GetGuild(guildId); - if (g?.GetChannel(channelId) is not SocketTextChannel ch) + if (g?.GetChannel(channelId) is not ITextChannel ch) return false; ICurrencyEvent ce; diff --git a/src/NadekoBot/Modules/Gambling/FlipCoin/FlipCoinCommands.cs b/src/NadekoBot/Modules/Gambling/FlipCoin/FlipCoinCommands.cs index eaf593296..c4347fbe9 100644 --- a/src/NadekoBot/Modules/Gambling/FlipCoin/FlipCoinCommands.cs +++ b/src/NadekoBot/Modules/Gambling/FlipCoin/FlipCoinCommands.cs @@ -41,7 +41,7 @@ public partial class Gambling } [Cmd] - public async partial Task Flip(int count = 1) + public async Task Flip(int count = 1) { if (count is > 10 or < 1) { @@ -61,12 +61,12 @@ public partial class Gambling { if (result[i].Side == 0) { - imgs[i] = Image.Load(headsArr); + imgs[i] = Image.Load(headsArr); headCount++; } else { - imgs[i] = Image.Load(tailsArr); + imgs[i] = Image.Load(tailsArr); tailCount++; } } @@ -96,7 +96,7 @@ public partial class Gambling } [Cmd] - public async partial Task Betflip(ShmartNumber amount, BetFlipGuess guess) + public async Task Betflip(ShmartNumber amount, BetFlipGuess guess) { if (!await CheckBetMandatory(amount) || amount == 1) return; diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 56765e225..0ab3e92a2 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -66,7 +66,7 @@ public partial class Gambling : GamblingModule } [Cmd] - public async partial Task Economy() + public async Task Economy() { var ec = await _service.GetEconomyAsync(); decimal onePercent = 0; @@ -133,7 +133,7 @@ public partial class Gambling : GamblingModule }; [Cmd] - public async partial Task Timely() + public async Task Timely() { var val = Config.Timely.Amount; var period = Config.Timely.Cooldown; @@ -166,7 +166,7 @@ public partial class Gambling : GamblingModule [Cmd] [OwnerOnly] - public async partial Task TimelyReset() + public async Task TimelyReset() { await _service.RemoveAllTimelyClaimsAsync(); await ReplyConfirmLocalizedAsync(strs.timely_reset); @@ -174,7 +174,7 @@ public partial class Gambling : GamblingModule [Cmd] [OwnerOnly] - public async partial Task TimelySet(int amount, int period = 24) + public async Task TimelySet(int amount, int period = 24) { if (amount < 0 || period < 0) { @@ -199,7 +199,7 @@ public partial class Gambling : GamblingModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Raffle([Leftover] IRole role = null) + public async Task Raffle([Leftover] IRole role = null) { role ??= ctx.Guild.EveryoneRole; @@ -218,7 +218,7 @@ public partial class Gambling : GamblingModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task RaffleAny([Leftover] IRole role = null) + public async Task RaffleAny([Leftover] IRole role = null) { role ??= ctx.Guild.EveryoneRole; @@ -237,19 +237,19 @@ public partial class Gambling : GamblingModule [Cmd] [Priority(2)] - public partial Task CurrencyTransactions(int page = 1) + public Task CurrencyTransactions(int page = 1) => InternalCurrencyTransactions(ctx.User.Id, page); [Cmd] [OwnerOnly] [Priority(0)] - public partial Task CurrencyTransactions([Leftover] IUser usr) + public Task CurrencyTransactions([Leftover] IUser usr) => InternalCurrencyTransactions(usr.Id, 1); [Cmd] [OwnerOnly] [Priority(1)] - public partial Task CurrencyTransactions(IUser usr, int page) + public Task CurrencyTransactions(IUser usr, int page) => InternalCurrencyTransactions(usr.Id, page); private async Task InternalCurrencyTransactions(ulong userId, int page) @@ -299,7 +299,7 @@ public partial class Gambling : GamblingModule => $"{ct.DateAdded:HH:mm yyyy-MM-dd}"; [Cmd] - public async partial Task CurrencyTransaction(kwum id) + public async Task CurrencyTransaction(kwum id) { int intId = id; await using var uow = _db.GetDbContext(); @@ -356,7 +356,7 @@ public partial class Gambling : GamblingModule [Cmd] [Priority(0)] - public async partial Task Cash(ulong userId) + public async Task Cash(ulong userId) { var cur = await GetBalanceStringAsync(userId); await ReplyConfirmLocalizedAsync(strs.has(Format.Code(userId.ToString()), cur)); @@ -377,7 +377,7 @@ public partial class Gambling : GamblingModule [Cmd] [Priority(1)] - public async partial Task Cash([Leftover] IUser user = null) + public async Task Cash([Leftover] IUser user = null) { user ??= ctx.User; var cur = await GetBalanceStringAsync(user.Id); @@ -397,7 +397,7 @@ public partial class Gambling : GamblingModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg) + public async Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg) { if (amount <= 0 || ctx.User.Id == receiver.Id || receiver.IsBot) { @@ -416,27 +416,27 @@ public partial class Gambling : GamblingModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver) + public Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver) => Give(amount, receiver, null); [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] [Priority(0)] - public partial Task Award(long amount, IGuildUser usr, [Leftover] string msg) + public Task Award(long amount, IGuildUser usr, [Leftover] string msg) => Award(amount, usr.Id, msg); [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] [Priority(1)] - public partial Task Award(long amount, [Leftover] IGuildUser usr) + public Task Award(long amount, [Leftover] IGuildUser usr) => Award(amount, usr.Id); [Cmd] [OwnerOnly] [Priority(2)] - public async partial Task Award(long amount, ulong usrId, [Leftover] string msg = null) + public async Task Award(long amount, ulong usrId, [Leftover] string msg = null) { if (amount <= 0) { @@ -459,7 +459,7 @@ public partial class Gambling : GamblingModule [RequireContext(ContextType.Guild)] [OwnerOnly] [Priority(3)] - public async partial Task Award(long amount, [Leftover] IRole role) + public async Task Award(long amount, [Leftover] IRole role) { var users = (await ctx.Guild.GetUsersAsync()).Where(u => u.GetRoles().Contains(role)).ToList(); @@ -476,7 +476,7 @@ public partial class Gambling : GamblingModule [RequireContext(ContextType.Guild)] [OwnerOnly] [Priority(0)] - public async partial Task Take(long amount, [Leftover] IRole role) + public async Task Take(long amount, [Leftover] IRole role) { var users = (await role.GetMembersAsync()).ToList(); @@ -493,7 +493,7 @@ public partial class Gambling : GamblingModule [RequireContext(ContextType.Guild)] [OwnerOnly] [Priority(1)] - public async partial Task Take(long amount, [Leftover] IGuildUser user) + public async Task Take(long amount, [Leftover] IGuildUser user) { if (amount <= 0) { @@ -514,7 +514,7 @@ public partial class Gambling : GamblingModule [Cmd] [OwnerOnly] - public async partial Task Take(long amount, [Leftover] ulong usrId) + public async Task Take(long amount, [Leftover] ulong usrId) { if (amount <= 0) { @@ -535,7 +535,7 @@ public partial class Gambling : GamblingModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task RollDuel(IUser u) + public async Task RollDuel(IUser u) { if (ctx.User.Id == u.Id) { @@ -552,7 +552,7 @@ public partial class Gambling : GamblingModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task RollDuel(ShmartNumber amount, IUser u) + public async Task RollDuel(ShmartNumber amount, IUser u) { if (ctx.User.Id == u.Id) { @@ -643,7 +643,7 @@ public partial class Gambling : GamblingModule } [Cmd] - public async partial Task BetRoll(ShmartNumber amount) + public async Task BetRoll(ShmartNumber amount) { if (!await CheckBetMandatory(amount)) { @@ -682,13 +682,13 @@ public partial class Gambling : GamblingModule [Cmd] [NadekoOptions(typeof(LbOpts))] [Priority(0)] - public partial Task Leaderboard(params string[] args) + public Task Leaderboard(params string[] args) => Leaderboard(1, args); [Cmd] [NadekoOptions(typeof(LbOpts))] [Priority(1)] - public async partial Task Leaderboard(int page = 1, params string[] args) + public async Task Leaderboard(int page = 1, params string[] args) { if (--page < 0) { @@ -774,7 +774,7 @@ public partial class Gambling : GamblingModule } [Cmd] - public async partial Task Rps(InputRpsPick pick, ShmartNumber amount = default) + public async Task Rps(InputRpsPick pick, ShmartNumber amount = default) { static string GetRpsPick(InputRpsPick p) { @@ -834,7 +834,7 @@ public partial class Gambling : GamblingModule new[] { "⬆", "↖", "⬅", "↙", "⬇", "↘", "➡", "↗" }.ToImmutableArray(); [Cmd] - public async partial Task LuckyLadder(ShmartNumber amount) + public async Task LuckyLadder(ShmartNumber amount) { if (!await CheckBetMandatory(amount)) return; @@ -887,7 +887,7 @@ public partial class Gambling : GamblingModule [Cmd] [OwnerOnly] - public async partial Task BetTest() + public async Task BetTest() { await SendConfirmAsync(GetText(strs.available_tests), Enum.GetValues() @@ -897,7 +897,7 @@ public partial class Gambling : GamblingModule [Cmd] [OwnerOnly] - public async partial Task BetTest(GambleTestTarget target, int tests = 1000) + public async Task BetTest(GambleTestTarget target, int tests = 1000) { if (tests <= 0) return; diff --git a/src/NadekoBot/Modules/Gambling/PlantPick/PlantAndPickCommands.cs b/src/NadekoBot/Modules/Gambling/PlantPick/PlantAndPickCommands.cs index 19d8bedb2..ecc5f6dd7 100644 --- a/src/NadekoBot/Modules/Gambling/PlantPick/PlantAndPickCommands.cs +++ b/src/NadekoBot/Modules/Gambling/PlantPick/PlantAndPickCommands.cs @@ -18,7 +18,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Pick(string pass = null) + public async Task Pick(string pass = null) { if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric()) return; @@ -44,7 +44,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Plant(ShmartNumber amount, string pass = null) + public async Task Plant(ShmartNumber amount, string pass = null) { if (amount < 1) return; @@ -75,7 +75,7 @@ public partial class Gambling #if GLOBAL_NADEKO [OwnerOnly] #endif - public async partial Task GenCurrency() + public async Task GenCurrency() { var enabled = _service.ToggleCurrencyGeneration(ctx.Guild.Id, ctx.Channel.Id); if (enabled) @@ -88,7 +88,7 @@ public partial class Gambling [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [OwnerOnly] - public partial Task GenCurList(int page = 1) + public Task GenCurList(int page = 1) { if (--page < 0) return Task.CompletedTask; diff --git a/src/NadekoBot/Modules/Gambling/PlantPick/PlantPickService.cs b/src/NadekoBot/Modules/Gambling/PlantPick/PlantPickService.cs index cd9b5f372..5d6a36e25 100644 --- a/src/NadekoBot/Modules/Gambling/PlantPick/PlantPickService.cs +++ b/src/NadekoBot/Modules/Gambling/PlantPick/PlantPickService.cs @@ -143,7 +143,10 @@ public class PlantPickService : INService, IExecNoCommand img.Mutate(x => { // measure the size of the text to be drawing - var size = TextMeasurer.Measure(pass, new(font, new PointF(0, 0))); + var size = TextMeasurer.Measure(pass, new TextOptions(font) + { + Origin = new PointF(0, 0) + }); // fill the background with black, add 5 pixels on each side to make it look better x.FillPolygon(Color.ParseHex("00000080"), diff --git a/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleCommands.cs b/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleCommands.cs index 5c9fbc9b0..223e80650 100644 --- a/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Raffle/CurrencyRaffleCommands.cs @@ -19,13 +19,13 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public partial Task RaffleCur(Mixed _, ShmartNumber amount) + public Task RaffleCur(Mixed _, ShmartNumber amount) => RaffleCur(amount, true); [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task RaffleCur(ShmartNumber amount, bool mixed = false) + public async Task RaffleCur(ShmartNumber amount, bool mixed = false) { if (!await CheckBetMandatory(amount)) return; diff --git a/src/NadekoBot/Modules/Gambling/Shop/ShopCommands.cs b/src/NadekoBot/Modules/Gambling/Shop/ShopCommands.cs index d753542be..7585b4969 100644 --- a/src/NadekoBot/Modules/Gambling/Shop/ShopCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Shop/ShopCommands.cs @@ -67,7 +67,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Shop(int page = 1) + public Task Shop(int page = 1) { if (--page < 0) return Task.CompletedTask; @@ -77,7 +77,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Buy(int index) + public async Task Buy(int index) { index -= 1; if (index < 0) @@ -206,7 +206,7 @@ public partial class Gambling [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [BotPerm(GuildPerm.ManageRoles)] - public async partial Task ShopAdd(Role _, int price, [Leftover] IRole role) + public async Task ShopAdd(Role _, int price, [Leftover] IRole role) { if (price < 1) return; @@ -239,7 +239,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopAdd(List _, int price, [Leftover] string name) + public async Task ShopAdd(List _, int price, [Leftover] string name) { if (price < 1) return; @@ -271,7 +271,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopListAdd(int index, [Leftover] string itemText) + public async Task ShopListAdd(int index, [Leftover] string itemText) { index -= 1; if (index < 0) @@ -313,7 +313,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopRemove(int index) + public async Task ShopRemove(int index) { index -= 1; if (index < 0) @@ -343,7 +343,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopChangePrice(int index, int price) + public async Task ShopChangePrice(int index, int price) { if (--index < 0 || price <= 0) return; @@ -361,7 +361,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopChangeName(int index, [Leftover] string newName) + public async Task ShopChangeName(int index, [Leftover] string newName) { if (--index < 0 || string.IsNullOrWhiteSpace(newName)) return; @@ -379,7 +379,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopSwap(int index1, int index2) + public async Task ShopSwap(int index1, int index2) { if (--index1 < 0 || --index2 < 0 || index1 == index2) return; @@ -397,7 +397,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task ShopMove(int fromIndex, int toIndex) + public async Task ShopMove(int fromIndex, int toIndex) { if (--fromIndex < 0 || --toIndex < 0 || fromIndex == toIndex) return; diff --git a/src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs b/src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs index aeef3bcab..01dfa6e3a 100644 --- a/src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Slot/SlotCommands.cs @@ -55,7 +55,7 @@ public partial class Gambling [Cmd] [OwnerOnly] - public async partial Task SlotStats() + public async Task SlotStats() { //i remembered to not be a moron var paid = totalPaidOut; @@ -85,7 +85,7 @@ public partial class Gambling } [Cmd] - public async partial Task Slot(ShmartNumber amount) + public async Task Slot(ShmartNumber amount) { if (!await CheckBetMandatory(amount)) return; @@ -230,49 +230,37 @@ public partial class Gambling Color fontColor = Config.Slots.CurrencyFontColor; - bgImage.Mutate(x => x.DrawText(new() + bgImage.Mutate(x => x.DrawText(new TextOptions(_fonts.DottyFont.CreateFont(65)) { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - WrapTextWidth = 140 - } + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + WrappingLength = 140, + Origin = new(227, 92) }, ((long)result.Won).ToString(), - _fonts.DottyFont.CreateFont(65), - fontColor, - new(227, 92))); + fontColor)); var bottomFont = _fonts.DottyFont.CreateFont(50); - bgImage.Mutate(x => x.DrawText(new() + bgImage.Mutate(x => x.DrawText(new TextOptions(bottomFont) { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - WrapTextWidth = 135 - } + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + WrappingLength = 135, + Origin = new(129, 472) }, amount.ToString(), - bottomFont, - fontColor, - new(129, 472))); + fontColor)); - bgImage.Mutate(x => x.DrawText(new() + bgImage.Mutate(x => x.DrawText(new(bottomFont) { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - WrapTextWidth = 135 - } + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + WrappingLength = 135, + Origin = new(325, 472) }, ownedAmount.ToString(), - bottomFont, - fontColor, - new(325, 472))); + fontColor)); //sw.PrintLap("drew red text"); for (var i = 0; i < 3; i++) diff --git a/src/NadekoBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs index 7157aa4a1..8e5382549 100644 --- a/src/NadekoBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs @@ -17,7 +17,7 @@ public partial class Gambling } [Cmd] - public async partial Task WaifuReset() + public async Task WaifuReset() { var price = _service.GetResetPrice(ctx.User); var embed = _eb.Create() @@ -38,7 +38,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task WaifuClaim(long amount, [Leftover] IUser target) + public async Task WaifuClaim(long amount, [Leftover] IUser target) { if (amount < Config.Waifu.MinPrice) { @@ -78,7 +78,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task WaifuTransfer(ulong waifuId, IUser newOwner) + public async Task WaifuTransfer(ulong waifuId, IUser newOwner) { if (!await _service.WaifuTransfer(ctx.User, waifuId, newOwner)) { @@ -94,7 +94,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task WaifuTransfer(IUser waifu, IUser newOwner) + public async Task WaifuTransfer(IUser waifu, IUser newOwner) { if (!await _service.WaifuTransfer(ctx.User, waifu.Id, newOwner)) { @@ -110,7 +110,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(-1)] - public partial Task Divorce([Leftover] string target) + public Task Divorce([Leftover] string target) { var waifuUserId = _service.GetWaifuUserId(ctx.User.Id, target); if (waifuUserId == default) @@ -122,13 +122,13 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public partial Task Divorce([Leftover] IGuildUser target) + public Task Divorce([Leftover] IGuildUser target) => Divorce(target.Id); [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task Divorce([Leftover] ulong targetId) + public async Task Divorce([Leftover] ulong targetId) { if (targetId == ctx.User.Id) return; @@ -154,7 +154,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Affinity([Leftover] IGuildUser user = null) + public async Task Affinity([Leftover] IGuildUser user = null) { if (user?.Id == ctx.User.Id) { @@ -190,7 +190,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task WaifuLb(int page = 1) + public async Task WaifuLb(int page = 1) { page--; @@ -223,7 +223,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task WaifuInfo([Leftover] IUser target = null) + public Task WaifuInfo([Leftover] IUser target = null) { if (target is null) target = ctx.User; @@ -234,7 +234,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public partial Task WaifuInfo(ulong targetId) + public Task WaifuInfo(ulong targetId) => InternalWaifuInfo(targetId); private async Task InternalWaifuInfo(ulong targetId, string name = null) @@ -287,7 +287,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task WaifuGift(int page = 1) + public async Task WaifuGift(int page = 1) { if (--page < 0 || page > (Config.Waifu.Items.Count - 1) / 9) return; @@ -317,7 +317,7 @@ public partial class Gambling [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task WaifuGift(string itemName, [Leftover] IUser waifu) + public async Task WaifuGift(string itemName, [Leftover] IUser waifu) { if (waifu.Id == ctx.User.Id) return; diff --git a/src/NadekoBot/Modules/Games/Acrophobia/AcropobiaCommands.cs b/src/NadekoBot/Modules/Games/Acrophobia/AcropobiaCommands.cs index 0ab079a7d..6c4e083b5 100644 --- a/src/NadekoBot/Modules/Games/Acrophobia/AcropobiaCommands.cs +++ b/src/NadekoBot/Modules/Games/Acrophobia/AcropobiaCommands.cs @@ -18,7 +18,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] [NadekoOptions(typeof(AcrophobiaGame.Options))] - public async partial Task Acrophobia(params string[] args) + public async Task Acrophobia(params string[] args) { var (options, _) = OptionsParser.ParseFrom(new AcrophobiaGame.Options(), args); var channel = (ITextChannel)ctx.Channel; diff --git a/src/NadekoBot/Modules/Games/ChatterBot/CleverBotCommands.cs b/src/NadekoBot/Modules/Games/ChatterBot/CleverBotCommands.cs index d96efaacd..e90bdc127 100644 --- a/src/NadekoBot/Modules/Games/ChatterBot/CleverBotCommands.cs +++ b/src/NadekoBot/Modules/Games/ChatterBot/CleverBotCommands.cs @@ -17,7 +17,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task Cleverbot() + public async Task Cleverbot() { var channel = (ITextChannel)ctx.Channel; diff --git a/src/NadekoBot/Modules/Games/Games.cs b/src/NadekoBot/Modules/Games/Games.cs index 4089b0290..49f94cd55 100644 --- a/src/NadekoBot/Modules/Games/Games.cs +++ b/src/NadekoBot/Modules/Games/Games.cs @@ -21,7 +21,7 @@ public partial class Games : NadekoModule } [Cmd] - public async partial Task Choose([Leftover] string list = null) + public async Task Choose([Leftover] string list = null) { if (string.IsNullOrWhiteSpace(list)) return; @@ -33,7 +33,7 @@ public partial class Games : NadekoModule } [Cmd] - public async partial Task EightBall([Leftover] string question = null) + public async Task EightBall([Leftover] string question = null) { if (string.IsNullOrWhiteSpace(question)) return; @@ -48,7 +48,7 @@ public partial class Games : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task RateGirl([Leftover] IGuildUser usr) + public async Task RateGirl([Leftover] IGuildUser usr) { var gr = _service.GirlRatings.GetOrAdd(usr.Id, GetGirl); var originalStream = await gr.Stream; @@ -140,7 +140,7 @@ public partial class Games : NadekoModule } [Cmd] - public async partial Task Linux(string guhnoo, string loonix) + public async Task Linux(string guhnoo, string loonix) => await SendConfirmAsync( $@"I'd just like to interject for moment. What you're refering to as {loonix}, is in fact, {guhnoo}/{loonix}, or as I've recently taken to calling it, {guhnoo} plus {loonix}. {loonix} is not an operating system unto itself, but rather another free component of a fully functioning {guhnoo} system made useful by the {guhnoo} corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX. diff --git a/src/NadekoBot/Modules/Games/Hangman/HangmanCommands.cs b/src/NadekoBot/Modules/Games/Hangman/HangmanCommands.cs index 24d70a568..dc5fb56ef 100644 --- a/src/NadekoBot/Modules/Games/Hangman/HangmanCommands.cs +++ b/src/NadekoBot/Modules/Games/Hangman/HangmanCommands.cs @@ -10,7 +10,7 @@ public partial class Games { [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Hangmanlist() + public async Task Hangmanlist() => await SendConfirmAsync(GetText(strs.hangman_types(prefix)), _service.GetHangmanTypes().Join('\n')); private static string Draw(HangmanGame.State state) @@ -51,7 +51,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Hangman([Leftover] string? type = null) + public async Task Hangman([Leftover] string? type = null) { if (!_service.StartHangman(ctx.Channel.Id, type, out var hangman)) { @@ -66,7 +66,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task HangmanStop() + public async Task HangmanStop() { if (await _service.StopHangman(ctx.Channel.Id)) await ReplyConfirmLocalizedAsync(strs.hangman_stopped); diff --git a/src/NadekoBot/Modules/Games/Nunchi/NunchiCommands.cs b/src/NadekoBot/Modules/Games/Nunchi/NunchiCommands.cs index 793e42af9..f7041ac96 100644 --- a/src/NadekoBot/Modules/Games/Nunchi/NunchiCommands.cs +++ b/src/NadekoBot/Modules/Games/Nunchi/NunchiCommands.cs @@ -16,7 +16,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Nunchi() + public async Task Nunchi() { var newNunchi = new NunchiGame(ctx.User.Id, ctx.User.ToString()); NunchiGame nunchi; diff --git a/src/NadekoBot/Modules/Games/Polls/PollCommands.cs b/src/NadekoBot/Modules/Games/Polls/PollCommands.cs index 51fd8e986..837792157 100644 --- a/src/NadekoBot/Modules/Games/Polls/PollCommands.cs +++ b/src/NadekoBot/Modules/Games/Polls/PollCommands.cs @@ -18,7 +18,7 @@ public partial class Games [Cmd] [UserPerm(GuildPerm.ManageMessages)] [RequireContext(ContextType.Guild)] - public async partial Task Poll([Leftover] string arg) + public async Task Poll([Leftover] string arg) { if (string.IsNullOrWhiteSpace(arg)) return; @@ -48,7 +48,7 @@ public partial class Games [Cmd] [UserPerm(GuildPerm.ManageMessages)] [RequireContext(ContextType.Guild)] - public async partial Task PollStats() + public async Task PollStats() { if (!_service.ActivePolls.TryGetValue(ctx.Guild.Id, out var pr)) return; @@ -59,7 +59,7 @@ public partial class Games [Cmd] [UserPerm(GuildPerm.ManageMessages)] [RequireContext(ContextType.Guild)] - public async partial Task Pollend() + public async Task Pollend() { Poll p; if ((p = _service.StopPoll(ctx.Guild.Id)) is null) diff --git a/src/NadekoBot/Modules/Games/SpeedTyping/SpeedTypingCommands.cs b/src/NadekoBot/Modules/Games/SpeedTyping/SpeedTypingCommands.cs index 524f18240..9b6dff52f 100644 --- a/src/NadekoBot/Modules/Games/SpeedTyping/SpeedTypingCommands.cs +++ b/src/NadekoBot/Modules/Games/SpeedTyping/SpeedTypingCommands.cs @@ -21,7 +21,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] [NadekoOptionsAttribute(typeof(TypingGame.Options))] - public async partial Task TypeStart(params string[] args) + public async Task TypeStart(params string[] args) { var (options, _) = OptionsParser.ParseFrom(new TypingGame.Options(), args); var channel = (ITextChannel)ctx.Channel; @@ -37,7 +37,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task TypeStop() + public async Task TypeStop() { if (_service.RunningContests.TryRemove(ctx.Guild.Id, out var game)) { @@ -52,7 +52,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task Typeadd([Leftover] string text) + public async Task Typeadd([Leftover] string text) { if (string.IsNullOrWhiteSpace(text)) return; @@ -64,7 +64,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Typelist(int page = 1) + public async Task Typelist(int page = 1) { if (page < 1) return; @@ -85,7 +85,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task Typedel(int index) + public async Task Typedel(int index) { var removed = _service.RemoveTypingArticle(--index); diff --git a/src/NadekoBot/Modules/Games/TicTacToe/TicTacToeCommands.cs b/src/NadekoBot/Modules/Games/TicTacToe/TicTacToeCommands.cs index 066fe6d4c..b01282a6f 100644 --- a/src/NadekoBot/Modules/Games/TicTacToe/TicTacToeCommands.cs +++ b/src/NadekoBot/Modules/Games/TicTacToe/TicTacToeCommands.cs @@ -18,7 +18,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] [NadekoOptions(typeof(TicTacToe.Options))] - public async partial Task TicTacToe(params string[] args) + public async Task TicTacToe(params string[] args) { var (options, _) = OptionsParser.ParseFrom(new TicTacToe.Options(), args); var channel = (ITextChannel)ctx.Channel; diff --git a/src/NadekoBot/Modules/Games/Trivia/Games.cs b/src/NadekoBot/Modules/Games/Trivia/Games.cs index 36d0c1225..d22e5e60b 100644 --- a/src/NadekoBot/Modules/Games/Trivia/Games.cs +++ b/src/NadekoBot/Modules/Games/Trivia/Games.cs @@ -31,7 +31,7 @@ public partial class Games [RequireContext(ContextType.Guild)] [Priority(0)] [NadekoOptions(typeof(TriviaOptions))] - public async partial Task Trivia(params string[] args) + public async Task Trivia(params string[] args) { var (opts, _) = OptionsParser.ParseFrom(new TriviaOptions(), args); @@ -56,7 +56,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Tl() + public async Task Tl() { if (_service.RunningTrivias.TryGetValue(ctx.Guild.Id, out var trivia)) { @@ -69,7 +69,7 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Tq() + public async Task Tq() { var channel = (ITextChannel)ctx.Channel; diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/NadekoBot/Modules/Help/Help.cs index dce48814c..52e26b03c 100644 --- a/src/NadekoBot/Modules/Help/Help.cs +++ b/src/NadekoBot/Modules/Help/Help.cs @@ -66,7 +66,7 @@ public partial class Help : NadekoModule } [Cmd] - public async partial Task Modules(int page = 1) + public async Task Modules(int page = 1) { if (--page < 0) return; @@ -171,7 +171,7 @@ public partial class Help : NadekoModule [Cmd] [NadekoOptions(typeof(CommandsOptions))] - public async partial Task Commands(string module = null, params string[] args) + public async Task Commands(string module = null, params string[] args) { module = module?.Trim().ToUpperInvariant(); if (string.IsNullOrWhiteSpace(module)) @@ -283,7 +283,7 @@ public partial class Help : NadekoModule [Cmd] [Priority(0)] - public async partial Task H([Leftover] string fail) + public async Task H([Leftover] string fail) { var prefixless = _cmds.Commands.FirstOrDefault(x => x.Aliases.Any(cmdName => cmdName.ToLowerInvariant() == fail)); @@ -312,7 +312,7 @@ public partial class Help : NadekoModule [Cmd] [Priority(1)] - public async partial Task H([Leftover] CommandInfo com = null) + public async Task H([Leftover] CommandInfo com = null) { var channel = ctx.Channel; @@ -342,7 +342,7 @@ public partial class Help : NadekoModule [Cmd] [OwnerOnly] - public async partial Task GenCmdList() + public async Task GenCmdList() { _ = ctx.Channel.TriggerTypingAsync(); @@ -464,7 +464,7 @@ public partial class Help : NadekoModule } [Cmd] - public async partial Task Guide() + public async Task Guide() => await ConfirmLocalizedAsync(strs.guide("https://nadeko.bot/commands", "https://nadekobot.readthedocs.io/en/latest/")); @@ -482,7 +482,7 @@ public partial class Help : NadekoModule [Cmd] [OnlyPublicBot] - public async partial Task Donate() + public async Task Donate() { var selfhostInter = new DonateSelfhostingInteraction(_client, ctx.User.Id, SelfhostAction); diff --git a/src/NadekoBot/Modules/Medusae/Medusa.cs b/src/NadekoBot/Modules/Medusae/Medusa.cs index 86b097e99..3d28c028a 100644 --- a/src/NadekoBot/Modules/Medusae/Medusa.cs +++ b/src/NadekoBot/Modules/Medusae/Medusa.cs @@ -8,7 +8,7 @@ public partial class Medusa : NadekoModule { [Cmd] [OwnerOnly] - public async partial Task MedusaLoad(string? name = null) + public async Task MedusaLoad(string? name = null) { if (string.IsNullOrWhiteSpace(name)) { @@ -60,7 +60,7 @@ public partial class Medusa : NadekoModule [Cmd] [OwnerOnly] - public async partial Task MedusaUnload(string? name = null) + public async Task MedusaUnload(string? name = null) { if (string.IsNullOrWhiteSpace(name)) { @@ -98,7 +98,7 @@ public partial class Medusa : NadekoModule [Cmd] [OwnerOnly] - public async partial Task MedusaList() + public async Task MedusaList() { var all = _service.GetAllMedusae(); @@ -132,7 +132,7 @@ public partial class Medusa : NadekoModule [Cmd] [OwnerOnly] - public async partial Task MedusaInfo(string? name = null) + public async Task MedusaInfo(string? name = null) { var medusae = _service.GetLoadedMedusae(); diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index 7412a553a..d1a1e040c 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -155,7 +155,7 @@ public sealed partial class Music : NadekoModule // join vc [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Join() + public async Task Join() { var user = (IGuildUser)ctx.User; @@ -173,7 +173,7 @@ public sealed partial class Music : NadekoModule // leave vc (destroy) [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Destroy() + public async Task Destroy() { var valid = await ValidateAsync(); if (!valid) @@ -186,36 +186,36 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(2)] - public partial Task Play() + public Task Play() => Next(); // play - index = skip to that index [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task Play(int index) + public Task Play(int index) => MoveToIndex(index); // play - query = q(query) [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public partial Task Play([Leftover] string query) + public Task Play([Leftover] string query) => QueueByQuery(query); [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Queue([Leftover] string query) + public Task Queue([Leftover] string query) => QueueByQuery(query); [Cmd] [RequireContext(ContextType.Guild)] - public partial Task QueueNext([Leftover] string query) + public Task QueueNext([Leftover] string query) => QueueByQuery(query, true); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Volume(int vol) + public async Task Volume(int vol) { if (vol is < 0 or > 100) { @@ -233,7 +233,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Next() + public async Task Next() { var valid = await ValidateAsync(); if (!valid) @@ -247,7 +247,7 @@ public sealed partial class Music : NadekoModule // list queue, relevant page [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task ListQueue() + public async Task ListQueue() { // show page with the current track if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp)) @@ -262,7 +262,7 @@ public sealed partial class Music : NadekoModule // list queue, specify page [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task ListQueue(int page) + public async Task ListQueue(int page) { if (--page < 0) return; @@ -332,7 +332,7 @@ public sealed partial class Music : NadekoModule // search [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QueueSearch([Leftover] string query) + public async Task QueueSearch([Leftover] string query) { _ = ctx.Channel.TriggerTypingAsync(); @@ -385,7 +385,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task TrackRemove(int index) + public async Task TrackRemove(int index) { if (index < 1) { @@ -421,7 +421,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task TrackRemove(All _ = All.All) + public async Task TrackRemove(All _ = All.All) { var valid = await ValidateAsync(); if (!valid) @@ -439,7 +439,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Stop() + public async Task Stop() { var valid = await ValidateAsync(); if (!valid) @@ -465,7 +465,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QueueRepeat(InputRepeatType type = InputRepeatType.Queue) + public async Task QueueRepeat(InputRepeatType type = InputRepeatType.Queue) { var valid = await ValidateAsync(); if (!valid) @@ -483,7 +483,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Pause() + public async Task Pause() { var valid = await ValidateAsync(); if (!valid) @@ -500,19 +500,19 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Radio(string radioLink) + public Task Radio(string radioLink) => QueueByQuery(radioLink, false, MusicPlatform.Radio); [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public partial Task Local([Leftover] string path) + public Task Local([Leftover] string path) => QueueByQuery(path, false, MusicPlatform.Local); [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task LocalPlaylist([Leftover] string dirPath) + public async Task LocalPlaylist([Leftover] string dirPath) { if (string.IsNullOrWhiteSpace(dirPath)) return; @@ -551,7 +551,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task TrackMove(int from, int to) + public async Task TrackMove(int from, int to) { if (--from < 0 || --to < 0 || from == to) { @@ -592,12 +592,12 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public partial Task SoundCloudQueue([Leftover] string query) + public Task SoundCloudQueue([Leftover] string query) => QueueByQuery(query, false, MusicPlatform.SoundCloud); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task SoundCloudPl([Leftover] string playlist) + public async Task SoundCloudPl([Leftover] string playlist) { if (string.IsNullOrWhiteSpace(playlist)) return; @@ -622,7 +622,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Playlist([Leftover] string playlistQuery) + public async Task Playlist([Leftover] string playlistQuery) { if (string.IsNullOrWhiteSpace(playlistQuery)) return; @@ -653,7 +653,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task NowPlaying() + public async Task NowPlaying() { var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel)ctx.Channel); if (mp is null) @@ -679,7 +679,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task PlaylistShuffle() + public async Task PlaylistShuffle() { var valid = await ValidateAsync(); if (!valid) @@ -699,7 +699,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task SetMusicChannel() + public async Task SetMusicChannel() { await _service.SetMusicChannelAsync(ctx.Guild.Id, ctx.Channel.Id); @@ -709,7 +709,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task UnsetMusicChannel() + public async Task UnsetMusicChannel() { await _service.SetMusicChannelAsync(ctx.Guild.Id, null); @@ -718,7 +718,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task AutoDisconnect() + public async Task AutoDisconnect() { var newState = await _service.ToggleAutoDisconnectAsync(ctx.Guild.Id); @@ -731,7 +731,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task MusicQuality() + public async Task MusicQuality() { var quality = await _service.GetMusicQualityAsync(ctx.Guild.Id); await ReplyConfirmLocalizedAsync(strs.current_music_quality(Format.Bold(quality.ToString()))); @@ -740,7 +740,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task MusicQuality(QualityPreset preset) + public async Task MusicQuality(QualityPreset preset) { await _service.SetMusicQualityAsync(ctx.Guild.Id, preset); await ReplyConfirmLocalizedAsync(strs.music_quality_set(Format.Bold(preset.ToString()))); @@ -748,7 +748,7 @@ public sealed partial class Music : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QueueAutoPlay() + public async Task QueueAutoPlay() { var newValue = await _service.ToggleQueueAutoPlayAsync(ctx.Guild.Id); if (newValue) diff --git a/src/NadekoBot/Modules/Music/PlaylistCommands.cs b/src/NadekoBot/Modules/Music/PlaylistCommands.cs index ac872647b..684666482 100644 --- a/src/NadekoBot/Modules/Music/PlaylistCommands.cs +++ b/src/NadekoBot/Modules/Music/PlaylistCommands.cs @@ -37,7 +37,7 @@ public sealed partial class Music [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Playlists([Leftover] int num = 1) + public async Task Playlists([Leftover] int num = 1) { if (num <= 0) return; @@ -60,7 +60,7 @@ public sealed partial class Music [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task DeletePlaylist([Leftover] int id) + public async Task DeletePlaylist([Leftover] int id) { var success = false; try @@ -91,7 +91,7 @@ public sealed partial class Music [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task PlaylistShow(int id, int page = 1) + public async Task PlaylistShow(int id, int page = 1) { if (page-- < 1) return; @@ -118,7 +118,7 @@ public sealed partial class Music [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Save([Leftover] string name) + public async Task Save([Leftover] string name) { if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp)) { @@ -159,7 +159,7 @@ public sealed partial class Music [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Load([Leftover] int id) + public async Task Load([Leftover] int id) { // expensive action, 1 at a time await _playlistLock.WaitAsync(); diff --git a/src/NadekoBot/Modules/Nsfw/Nsfw.cs b/src/NadekoBot/Modules/Nsfw/Nsfw.cs index 8427da096..3a180f1cf 100644 --- a/src/NadekoBot/Modules/Nsfw/Nsfw.cs +++ b/src/NadekoBot/Modules/Nsfw/Nsfw.cs @@ -61,7 +61,7 @@ public partial class NSFW : NadekoModule [RequireNsfw] [RequireContext(ContextType.Guild)] [UserPerm(ChannelPerm.ManageMessages)] - public async partial Task AutoHentai(int interval = 0, [Leftover] string tags = null) + public async Task AutoHentai(int interval = 0, [Leftover] string tags = null) { Timer t; @@ -115,7 +115,7 @@ public partial class NSFW : NadekoModule [RequireNsfw] [RequireContext(ContextType.Guild)] [UserPerm(ChannelPerm.ManageMessages)] - public async partial Task AutoBoobs(int interval = 0) + public async Task AutoBoobs(int interval = 0) { Timer t; @@ -162,7 +162,7 @@ public partial class NSFW : NadekoModule [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] [UserPerm(ChannelPerm.ManageMessages)] - public async partial Task AutoButts(int interval = 0) + public async Task AutoButts(int interval = 0) { Timer t; @@ -208,13 +208,13 @@ public partial class NSFW : NadekoModule [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Hentai(params string[] tags) + public Task Hentai(params string[] tags) => InternalDapiCommand(tags, true, _service.Hentai); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public async partial Task HentaiBomb(params string[] tags) + public async Task HentaiBomb(params string[] tags) { if (!_hentaiBombBlacklist.Add(ctx.Guild?.Id ?? ctx.User.Id)) return; @@ -243,61 +243,61 @@ public partial class NSFW : NadekoModule [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Yandere(params string[] tags) + public Task Yandere(params string[] tags) => InternalDapiCommand(tags, false, _service.Yandere); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Konachan(params string[] tags) + public Task Konachan(params string[] tags) => InternalDapiCommand(tags, false, _service.Konachan); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Sankaku(params string[] tags) + public Task Sankaku(params string[] tags) => InternalDapiCommand(tags, false, _service.Sankaku); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task E621(params string[] tags) + public Task E621(params string[] tags) => InternalDapiCommand(tags, false, _service.E621); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Rule34(params string[] tags) + public Task Rule34(params string[] tags) => InternalDapiCommand(tags, false, _service.Rule34); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Danbooru(params string[] tags) + public Task Danbooru(params string[] tags) => InternalDapiCommand(tags, false, _service.Danbooru); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Gelbooru(params string[] tags) + public Task Gelbooru(params string[] tags) => InternalDapiCommand(tags, false, _service.Gelbooru); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Derpibooru(params string[] tags) + public Task Derpibooru(params string[] tags) => InternalDapiCommand(tags, false, _service.DerpiBooru); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public partial Task Safebooru(params string[] tags) + public Task Safebooru(params string[] tags) => InternalDapiCommand(tags, false, _service.SafeBooru); [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public async partial Task Boobs() + public async Task Boobs() { try { @@ -319,7 +319,7 @@ public partial class NSFW : NadekoModule [Cmd] [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] - public async partial Task Butts() + public async Task Butts() { try { @@ -341,7 +341,7 @@ public partial class NSFW : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task NsfwTagBlacklist([Leftover] string tag = null) + public async Task NsfwTagBlacklist([Leftover] string tag = null) { if (string.IsNullOrWhiteSpace(tag)) { @@ -365,7 +365,7 @@ public partial class NSFW : NadekoModule [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] [Priority(1)] - public async partial Task Nhentai(uint id) + public async Task Nhentai(uint id) { var g = await _service.GetNhentaiByIdAsync(id); @@ -383,7 +383,7 @@ public partial class NSFW : NadekoModule [RequireNsfw(Group = "nsfw_or_dm")] [RequireContext(ContextType.DM, Group = "nsfw_or_dm")] [Priority(0)] - public async partial Task Nhentai([Leftover] string query) + public async Task Nhentai([Leftover] string query) { var g = await _service.GetNhentaiBySearchAsync(query); diff --git a/src/NadekoBot/Modules/Permissions/Blacklist/BlacklistCommands.cs b/src/NadekoBot/Modules/Permissions/Blacklist/BlacklistCommands.cs index f6578bcb1..6df32ba28 100644 --- a/src/NadekoBot/Modules/Permissions/Blacklist/BlacklistCommands.cs +++ b/src/NadekoBot/Modules/Permissions/Blacklist/BlacklistCommands.cs @@ -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) diff --git a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdsCommands.cs b/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdsCommands.cs index d17434e18..aecab2208 100644 --- a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdsCommands.cs +++ b/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdsCommands.cs @@ -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()); diff --git a/src/NadekoBot/Modules/Permissions/Filter/FilterCommands.cs b/src/NadekoBot/Modules/Permissions/Filter/FilterCommands.cs index def33b5d2..5da4503a6 100644 --- a/src/NadekoBot/Modules/Permissions/Filter/FilterCommands.cs +++ b/src/NadekoBot/Modules/Permissions/Filter/FilterCommands.cs @@ -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) diff --git a/src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionCommands.cs b/src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionCommands.cs index c537cab7e..907334f46 100644 --- a/src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionCommands.cs +++ b/src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionCommands.cs @@ -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); diff --git a/src/NadekoBot/Modules/Permissions/Permissions.cs b/src/NadekoBot/Modules/Permissions/Permissions.cs index b94dd08df..988ab4d9e 100644 --- a/src/NadekoBot/Modules/Permissions/Permissions.cs +++ b/src/NadekoBot/Modules/Permissions/Permissions.cs @@ -19,7 +19,7 @@ public partial class Permissions : NadekoModule [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [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 [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task AllSrvrMdls(PermissionAction action) + public async Task AllSrvrMdls(PermissionAction action) { var newPerm = new Permissionv2 { diff --git a/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs b/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs index 89619dea2..153345dec 100644 --- a/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs +++ b/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs @@ -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); diff --git a/src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs index ec8ccf39a..f756a0739 100644 --- a/src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs @@ -41,7 +41,7 @@ public partial class Searches [Cmd] [Priority(0)] - public async partial Task Mal([Leftover] string name) + public async Task Mal([Leftover] string name) { if (string.IsNullOrWhiteSpace(name)) return; @@ -135,11 +135,11 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task Mal(IGuildUser usr) + public Task Mal(IGuildUser usr) => Mal(usr.Username); [Cmd] - public async partial Task Anime([Leftover] string query) + public async Task Anime([Leftover] string query) { if (string.IsNullOrWhiteSpace(query)) return; @@ -171,7 +171,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Manga([Leftover] string query) + public async Task Manga([Leftover] string query) { if (string.IsNullOrWhiteSpace(query)) return; diff --git a/src/NadekoBot/Modules/Searches/Crypto/CryptoCommands.cs b/src/NadekoBot/Modules/Searches/Crypto/CryptoCommands.cs index 633b184eb..241a2172a 100644 --- a/src/NadekoBot/Modules/Searches/Crypto/CryptoCommands.cs +++ b/src/NadekoBot/Modules/Searches/Crypto/CryptoCommands.cs @@ -18,7 +18,7 @@ public partial class Searches } [Cmd] - public async partial Task Stock([Leftover]string query) + public async Task Stock([Leftover]string query) { using var typing = ctx.Channel.EnterTypingState(); @@ -116,7 +116,7 @@ public partial class Searches [Cmd] - public async partial Task Crypto(string name) + public async Task Crypto(string name) { name = name?.ToUpperInvariant(); diff --git a/src/NadekoBot/Modules/Searches/Feeds/FeedCommands.cs b/src/NadekoBot/Modules/Searches/Feeds/FeedCommands.cs index e97559df5..0692bbaee 100644 --- a/src/NadekoBot/Modules/Searches/Feeds/FeedCommands.cs +++ b/src/NadekoBot/Modules/Searches/Feeds/FeedCommands.cs @@ -16,7 +16,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public partial Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null) + public Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null) { var m = _ytChannelRegex.Match(url); if (!m.Success) @@ -30,7 +30,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task Feed(string url, [Leftover] ITextChannel channel = null) + public async 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); @@ -64,7 +64,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task FeedRemove(int index) + public async Task FeedRemove(int index) { if (_service.RemoveFeed(ctx.Guild.Id, --index)) await ReplyConfirmLocalizedAsync(strs.feed_removed); @@ -75,7 +75,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task FeedList() + public async Task FeedList() { var feeds = _service.GetFeeds(ctx.Guild.Id); diff --git a/src/NadekoBot/Modules/Searches/JokeCommands.cs b/src/NadekoBot/Modules/Searches/JokeCommands.cs index e872f3adb..95736efc6 100644 --- a/src/NadekoBot/Modules/Searches/JokeCommands.cs +++ b/src/NadekoBot/Modules/Searches/JokeCommands.cs @@ -9,22 +9,22 @@ public partial class Searches public partial class JokeCommands : NadekoModule { [Cmd] - public async partial Task Yomama() + public async Task Yomama() => await SendConfirmAsync(await _service.GetYomamaJoke()); [Cmd] - public async partial Task Randjoke() + public async Task Randjoke() { var (setup, punchline) = await _service.GetRandomJoke(); await SendConfirmAsync(setup, punchline); } [Cmd] - public async partial Task ChuckNorris() + public async Task ChuckNorris() => await SendConfirmAsync(await _service.GetChuckNorrisJoke()); [Cmd] - public async partial Task WowJoke() + public async Task WowJoke() { if (!_service.WowJokes.Any()) { @@ -37,7 +37,7 @@ public partial class Searches } [Cmd] - public async partial Task MagicItem() + public async Task MagicItem() { if (!_service.WowJokes.Any()) { diff --git a/src/NadekoBot/Modules/Searches/MemegenCommands.cs b/src/NadekoBot/Modules/Searches/MemegenCommands.cs index 10d471e27..f030be2e0 100644 --- a/src/NadekoBot/Modules/Searches/MemegenCommands.cs +++ b/src/NadekoBot/Modules/Searches/MemegenCommands.cs @@ -28,7 +28,7 @@ public partial class Searches => _httpFactory = factory; [Cmd] - public async partial Task Memelist(int page = 1) + public async Task Memelist(int page = 1) { if (--page < 0) return; @@ -55,7 +55,7 @@ public partial class Searches } [Cmd] - public async partial Task Memegen(string meme, [Leftover] string memeText = null) + public async Task Memegen(string meme, [Leftover] string memeText = null) { var memeUrl = $"http://api.memegen.link/{meme}"; if (!string.IsNullOrWhiteSpace(memeText)) diff --git a/src/NadekoBot/Modules/Searches/OsuCommands.cs b/src/NadekoBot/Modules/Searches/OsuCommands.cs index cbca61bce..7db1cd377 100644 --- a/src/NadekoBot/Modules/Searches/OsuCommands.cs +++ b/src/NadekoBot/Modules/Searches/OsuCommands.cs @@ -20,7 +20,7 @@ public partial class Searches } [Cmd] - public async partial Task Osu(string user, [Leftover] string mode = null) + public async Task Osu(string user, [Leftover] string mode = null) { if (string.IsNullOrWhiteSpace(user)) return; @@ -76,7 +76,7 @@ public partial class Searches } [Cmd] - public async partial Task Gatari(string user, [Leftover] string mode = null) + public async Task Gatari(string user, [Leftover] string mode = null) { using var http = _httpFactory.CreateClient(); var modeNumber = string.IsNullOrWhiteSpace(mode) ? 0 : ResolveGameMode(mode); @@ -114,7 +114,7 @@ public partial class Searches } [Cmd] - public async partial Task Osu5(string user, [Leftover] string mode = null) + public async Task Osu5(string user, [Leftover] string mode = null) { if (string.IsNullOrWhiteSpace(_creds.OsuApiKey)) { diff --git a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs b/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs index bb183f5e5..b53a09f99 100644 --- a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs +++ b/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs @@ -115,7 +115,7 @@ public partial class Searches => _httpFactory = httpFactory; [Cmd] - public async partial Task PathOfExile(string usr, string league = "", int page = 1) + public async Task PathOfExile(string usr, string league = "", int page = 1) { if (--page < 0) return; @@ -179,7 +179,7 @@ public partial class Searches } [Cmd] - public async partial Task PathOfExileLeagues() + public async Task PathOfExileLeagues() { var leagues = new List(); @@ -220,7 +220,7 @@ public partial class Searches } [Cmd] - public async partial Task PathOfExileCurrency( + public async Task PathOfExileCurrency( string leagueName, string currencyName, string convertName = "Chaos Orb") diff --git a/src/NadekoBot/Modules/Searches/PlaceCommands.cs b/src/NadekoBot/Modules/Searches/PlaceCommands.cs index 8342b9c03..363f7b851 100644 --- a/src/NadekoBot/Modules/Searches/PlaceCommands.cs +++ b/src/NadekoBot/Modules/Searches/PlaceCommands.cs @@ -21,11 +21,11 @@ public partial class Searches private static readonly string _typesStr = string.Join(", ", Enum.GetNames(typeof(PlaceType))); [Cmd] - public async partial Task Placelist() + public async Task Placelist() => await SendConfirmAsync(GetText(strs.list_of_place_tags(prefix)), _typesStr); [Cmd] - public async partial Task Place(PlaceType placeType, uint width = 0, uint height = 0) + public async Task Place(PlaceType placeType, uint width = 0, uint height = 0) { var url = string.Empty; switch (placeType) diff --git a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs index 8d2acd71f..7ff093fdf 100644 --- a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs @@ -15,7 +15,7 @@ public partial class Searches => _cache = cache; [Cmd] - public async partial Task Pokemon([Leftover] string pokemon = null) + public async Task Pokemon([Leftover] string pokemon = null) { pokemon = pokemon?.Trim().ToUpperInvariant(); if (string.IsNullOrWhiteSpace(pokemon)) @@ -47,7 +47,7 @@ public partial class Searches } [Cmd] - public async partial Task PokemonAbility([Leftover] string ability = null) + public async Task PokemonAbility([Leftover] string ability = null) { ability = ability?.Trim().ToUpperInvariant().Replace(" ", "", StringComparison.InvariantCulture); if (string.IsNullOrWhiteSpace(ability)) diff --git a/src/NadekoBot/Modules/Searches/Search/SearchCommands.cs b/src/NadekoBot/Modules/Searches/Search/SearchCommands.cs index 04f069473..dbb5a7ca7 100644 --- a/src/NadekoBot/Modules/Searches/Search/SearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/Search/SearchCommands.cs @@ -22,7 +22,7 @@ public partial class Searches } [Cmd] - public async partial Task Google([Leftover] string? query = null) + public async Task Google([Leftover] string? query = null) { query = query?.Trim(); @@ -76,7 +76,7 @@ public partial class Searches } [Cmd] - public async partial Task Image([Leftover] string? query = null) + public async Task Image([Leftover] string? query = null) { query = query?.Trim(); @@ -148,7 +148,7 @@ public partial class Searches } [Cmd] - public async partial Task Youtube([Leftover] string? query = null) + public async Task Youtube([Leftover] string? query = null) { query = query?.Trim(); @@ -173,7 +173,7 @@ public partial class Searches } // [Cmd] -// public async partial Task DuckDuckGo([Leftover] string query = null) +// public async Task DuckDuckGo([Leftover] string query = null) // { // query = query?.Trim(); // if (!await ValidateQuery(query)) diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index aed060d80..91601ae75 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -40,7 +40,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Rip([Leftover] IGuildUser usr) + public async Task Rip([Leftover] IGuildUser usr) { var av = usr.RealAvatarUrl(); await using var picStream = await _service.GetRipPictureAsync(usr.Nickname ?? usr.Username, av); @@ -50,7 +50,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Weather([Leftover] string query) + public async Task Weather([Leftover] string query) { if (!await ValidateQuery(query)) return; @@ -98,7 +98,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Time([Leftover] string query) + public async Task Time([Leftover] string query) { if (!await ValidateQuery(query)) return; @@ -146,7 +146,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Movie([Leftover] string query = null) + public async Task Movie([Leftover] string query = null) { if (!await ValidateQuery(query)) return; @@ -172,19 +172,19 @@ public partial class Searches : NadekoModule } [Cmd] - public partial Task RandomCat() + public Task RandomCat() => InternalRandomImage(SearchesService.ImageTag.Cats); [Cmd] - public partial Task RandomDog() + public Task RandomDog() => InternalRandomImage(SearchesService.ImageTag.Dogs); [Cmd] - public partial Task RandomFood() + public Task RandomFood() => InternalRandomImage(SearchesService.ImageTag.Food); [Cmd] - public partial Task RandomBird() + public Task RandomBird() => InternalRandomImage(SearchesService.ImageTag.Birds); private Task InternalRandomImage(SearchesService.ImageTag tag) @@ -194,7 +194,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Lmgtfy([Leftover] string ffs = null) + public async Task Lmgtfy([Leftover] string ffs = null) { if (!await ValidateQuery(ffs)) return; @@ -204,7 +204,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Shorten([Leftover] string query) + public async Task Shorten([Leftover] string query) { if (!await ValidateQuery(query)) return; @@ -247,7 +247,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task MagicTheGathering([Leftover] string search) + public async Task MagicTheGathering([Leftover] string search) { if (!await ValidateQuery(search)) return; @@ -274,7 +274,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Hearthstone([Leftover] string name) + public async Task Hearthstone([Leftover] string name) { if (!await ValidateQuery(name)) return; @@ -303,7 +303,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task UrbanDict([Leftover] string query = null) + public async Task UrbanDict([Leftover] string query = null) { if (!await ValidateQuery(query)) return; @@ -342,7 +342,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Define([Leftover] string word) + public async Task Define([Leftover] string word) { if (!await ValidateQuery(word)) return; @@ -413,7 +413,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Catfact() + public async Task Catfact() { using var http = _httpFactory.CreateClient(); var response = await http.GetStringAsync("https://catfact.ninja/fact"); @@ -425,7 +425,7 @@ public partial class Searches : NadekoModule //done in 3.0 [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Revav([Leftover] IGuildUser usr = null) + public async Task Revav([Leftover] IGuildUser usr = null) { if (usr is null) usr = (IGuildUser)ctx.User; @@ -436,7 +436,7 @@ public partial class Searches : NadekoModule //done in 3.0 [Cmd] - public async partial Task Revimg([Leftover] string imageLink = null) + public async Task Revimg([Leftover] string imageLink = null) { imageLink = imageLink?.Trim() ?? ""; @@ -447,7 +447,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Wiki([Leftover] string query = null) + public async Task Wiki([Leftover] string query = null) { query = query?.Trim(); @@ -466,7 +466,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Color(params Color[] colors) + public async Task Color(params Color[] colors) { if (!colors.Any()) return; @@ -486,7 +486,7 @@ public partial class Searches : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Avatar([Leftover] IGuildUser usr = null) + public async Task Avatar([Leftover] IGuildUser usr = null) { if (usr is null) usr = (IGuildUser)ctx.User; @@ -503,7 +503,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Wikia(string target, [Leftover] string query) + public async Task Wikia(string target, [Leftover] string query) { if (string.IsNullOrWhiteSpace(target) || string.IsNullOrWhiteSpace(query)) { @@ -544,7 +544,7 @@ public partial class Searches : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Bible(string book, string chapterAndVerse) + public async Task Bible(string book, string chapterAndVerse) { var obj = new BibleVerses(); try @@ -571,7 +571,7 @@ public partial class Searches : NadekoModule } [Cmd] - public async partial Task Steam([Leftover] string query) + public async Task Steam([Leftover] string query) { if (string.IsNullOrWhiteSpace(query)) return; diff --git a/src/NadekoBot/Modules/Searches/SearchesService.cs b/src/NadekoBot/Modules/Searches/SearchesService.cs index e088c489f..e8a1201a8 100644 --- a/src/NadekoBot/Modules/Searches/SearchesService.cs +++ b/src/NadekoBot/Modules/Searches/SearchesService.cs @@ -105,18 +105,14 @@ public class SearchesService : INService } bg.Mutate(x => x.DrawText( - new() + new TextOptions(_fonts.RipFont) { - TextOptions = new TextOptions - { - HorizontalAlignment = HorizontalAlignment.Center, - WrapTextWidth = 190 - }.WithFallbackFonts(_fonts.FallBackFonts) + HorizontalAlignment = HorizontalAlignment.Center, + FallbackFontFamilies = _fonts.FallBackFonts, + Origin = new(bg.Width / 2, 225), }, text, - _fonts.RipFont, - Color.Black, - new(25, 225))); + Color.Black)); //flowa using (var flowers = Image.Load(await _imgs.GetRipOverlayAsync())) diff --git a/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationCommands.cs b/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationCommands.cs index b9e6dcab5..8e9d0df21 100644 --- a/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationCommands.cs +++ b/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationCommands.cs @@ -19,7 +19,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task StreamAdd(string link) + public async Task StreamAdd(string link) { var data = await _service.FollowStream(ctx.Guild.Id, ctx.Channel.Id, link); if (data is null) @@ -36,7 +36,7 @@ public partial class Searches [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(1)] - public async partial Task StreamRemove(int index) + public async Task StreamRemove(int index) { if (--index < 0) return; @@ -54,7 +54,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task StreamsClear() + public async Task StreamsClear() { await _service.ClearAllStreams(ctx.Guild.Id); await ReplyConfirmLocalizedAsync(strs.streams_cleared); @@ -62,7 +62,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task StreamList(int page = 1) + public async Task StreamList(int page = 1) { if (page-- < 1) return; @@ -113,7 +113,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task StreamOffline() + public async Task StreamOffline() { var newValue = _service.ToggleStreamOffline(ctx.Guild.Id); if (newValue) @@ -125,7 +125,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task StreamOnlineDelete() + public async Task StreamOnlineDelete() { var newValue = _service.ToggleStreamOnlineDelete(ctx.Guild.Id); if (newValue) @@ -137,7 +137,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task StreamMessage(int index, [Leftover] string message) + public async Task StreamMessage(int index, [Leftover] string message) { if (--index < 0) return; @@ -157,7 +157,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task StreamMessageAll([Leftover] string message) + public async Task StreamMessageAll([Leftover] string message) { var count = _service.SetStreamMessageForAll(ctx.Guild.Id, message); @@ -172,7 +172,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task StreamCheck(string url) + public async Task StreamCheck(string url) { try { diff --git a/src/NadekoBot/Modules/Searches/Translate/TranslatorCommands.cs b/src/NadekoBot/Modules/Searches/Translate/TranslatorCommands.cs index f714d59de..a4e4c0b44 100644 --- a/src/NadekoBot/Modules/Searches/Translate/TranslatorCommands.cs +++ b/src/NadekoBot/Modules/Searches/Translate/TranslatorCommands.cs @@ -13,7 +13,7 @@ public partial class Searches } [Cmd] - public async partial Task Translate(string from, string to, [Leftover] string text = null) + public async Task Translate(string from, string to, [Leftover] string text = null) { try { @@ -35,7 +35,7 @@ public partial class Searches [UserPerm(GuildPerm.Administrator)] [BotPerm(ChannelPerm.ManageMessages)] [OwnerOnly] - public async partial Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel) + public async Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel) { var toggle = await _service.ToggleAtl(ctx.Guild.Id, ctx.Channel.Id, autoDelete == AutoDeleteAutoTranslate.Del); @@ -47,7 +47,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task AutoTransLang() + public async Task AutoTransLang() { if (await _service.UnregisterUser(ctx.Channel.Id, ctx.User.Id)) await ReplyConfirmLocalizedAsync(strs.atl_removed); @@ -55,7 +55,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task AutoTransLang(string from, string to) + public async Task AutoTransLang(string from, string to) { var succ = await _service.RegisterUserAsync(ctx.User.Id, ctx.Channel.Id, from.ToLower(), to.ToLower()); @@ -76,7 +76,7 @@ public partial class Searches [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Translangs() + public async Task Translangs() => await ctx.Channel.SendTableAsync(_service.GetLanguages(), str => $"{str,-15}"); } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Searches/XkcdCommands.cs b/src/NadekoBot/Modules/Searches/XkcdCommands.cs index 7718a99f0..8aeed026a 100644 --- a/src/NadekoBot/Modules/Searches/XkcdCommands.cs +++ b/src/NadekoBot/Modules/Searches/XkcdCommands.cs @@ -16,7 +16,7 @@ public partial class Searches [Cmd] [Priority(0)] - public async partial Task Xkcd(string arg = null) + public async Task Xkcd(string arg = null) { if (arg?.ToLowerInvariant().Trim() == "latest") { @@ -50,7 +50,7 @@ public partial class Searches [Cmd] [Priority(1)] - public async partial Task Xkcd(int num) + public async Task Xkcd(int num) { if (num < 1) return; diff --git a/src/NadekoBot/Modules/Utility/Calc/CalcCommands.cs b/src/NadekoBot/Modules/Utility/Calc/CalcCommands.cs index 0a892f9e3..fb0c1126a 100644 --- a/src/NadekoBot/Modules/Utility/Calc/CalcCommands.cs +++ b/src/NadekoBot/Modules/Utility/Calc/CalcCommands.cs @@ -10,7 +10,7 @@ public partial class Utility public partial class CalcCommands : NadekoModule { [Cmd] - public async partial Task Calculate([Leftover] string expression) + public async Task Calculate([Leftover] string expression) { var expr = new Expression(expression, EvaluateOptions.IgnoreCase | EvaluateOptions.NoCache); expr.EvaluateParameter += Expr_EvaluateParameter; @@ -35,7 +35,7 @@ public partial class Utility } [Cmd] - public async partial Task CalcOps() + public async Task CalcOps() { var selection = typeof(Math).GetTypeInfo() .GetMethods() diff --git a/src/NadekoBot/Modules/Utility/CommandMap/CommandMapCommands.cs b/src/NadekoBot/Modules/Utility/CommandMap/CommandMapCommands.cs index e9a789dd4..2b0976428 100644 --- a/src/NadekoBot/Modules/Utility/CommandMap/CommandMapCommands.cs +++ b/src/NadekoBot/Modules/Utility/CommandMap/CommandMapCommands.cs @@ -23,7 +23,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task AliasesClear() + public async Task AliasesClear() { var count = _service.ClearAliases(ctx.Guild.Id); await ReplyConfirmLocalizedAsync(strs.aliases_cleared(count)); @@ -32,7 +32,7 @@ public partial class Utility [Cmd] [UserPerm(GuildPerm.Administrator)] [RequireContext(ContextType.Guild)] - public async partial Task Alias(string trigger, [Leftover] string mapping = null) + public async Task Alias(string trigger, [Leftover] string mapping = null) { if (string.IsNullOrWhiteSpace(trigger)) return; @@ -106,7 +106,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task AliasList(int page = 1) + public async Task AliasList(int page = 1) { page -= 1; diff --git a/src/NadekoBot/Modules/Utility/ConfigCommands.cs b/src/NadekoBot/Modules/Utility/ConfigCommands.cs index 7f15c186f..af1f6aee5 100644 --- a/src/NadekoBot/Modules/Utility/ConfigCommands.cs +++ b/src/NadekoBot/Modules/Utility/ConfigCommands.cs @@ -12,7 +12,7 @@ public partial class Utility [Cmd] [OwnerOnly] - public async partial Task ConfigReload(string name) + public async Task ConfigReload(string name) { var setting = _settingServices.FirstOrDefault(x => x.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase)); @@ -35,7 +35,7 @@ public partial class Utility [Cmd] [OwnerOnly] - public async partial Task Config(string name = null, string prop = null, [Leftover] string value = null) + public async Task Config(string name = null, string prop = null, [Leftover] string value = null) { var configNames = _settingServices.Select(x => x.Name); diff --git a/src/NadekoBot/Modules/Utility/Info/InfoCommands.cs b/src/NadekoBot/Modules/Utility/Info/InfoCommands.cs index fc916d517..a2d740431 100644 --- a/src/NadekoBot/Modules/Utility/Info/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/Info/InfoCommands.cs @@ -23,12 +23,12 @@ public partial class Utility [Cmd] [OwnerOnly] - public partial Task ServerInfo([Leftover] string guildName) + public Task ServerInfo([Leftover] string guildName) => InternalServerInfo(guildName); [Cmd] [RequireContext(ContextType.Guild)] - public partial Task ServerInfo() + public Task ServerInfo() => InternalServerInfo(); private async Task InternalServerInfo(string guildName = null) @@ -81,7 +81,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task ChannelInfo(ITextChannel channel = null) + public async Task ChannelInfo(ITextChannel channel = null) { var ch = channel ?? (ITextChannel)ctx.Channel; if (ch is null) @@ -100,7 +100,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task UserInfo(IGuildUser usr = null) + public async Task UserInfo(IGuildUser usr = null) { var user = usr ?? ctx.User as IGuildUser; @@ -143,7 +143,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task Activity(int page = 1) + public async Task Activity(int page = 1) { const int activityPerPage = 10; page -= 1; diff --git a/src/NadekoBot/Modules/Utility/Info/InviteCommands.cs b/src/NadekoBot/Modules/Utility/Info/InviteCommands.cs index 62dae53bd..775402e5c 100644 --- a/src/NadekoBot/Modules/Utility/Info/InviteCommands.cs +++ b/src/NadekoBot/Modules/Utility/Info/InviteCommands.cs @@ -13,7 +13,7 @@ public partial class Utility [BotPerm(ChannelPerm.CreateInstantInvite)] [UserPerm(ChannelPerm.CreateInstantInvite)] [NadekoOptions(typeof(InviteService.Options))] - public async partial Task InviteCreate(params string[] args) + public async Task InviteCreate(params string[] args) { var (opts, success) = OptionsParser.ParseFrom(new InviteService.Options(), args); if (!success) @@ -29,7 +29,7 @@ public partial class Utility [RequireContext(ContextType.Guild)] [BotPerm(ChannelPerm.ManageChannels)] [UserPerm(ChannelPerm.ManageChannels)] - public async partial Task InviteList(int page = 1, [Leftover] ITextChannel ch = null) + public async Task InviteList(int page = 1, [Leftover] ITextChannel ch = null) { if (--page < 0) return; @@ -73,7 +73,7 @@ public partial class Utility [RequireContext(ContextType.Guild)] [BotPerm(ChannelPerm.ManageChannels)] [UserPerm(ChannelPerm.ManageChannels)] - public async partial Task InviteDelete(int index) + public async Task InviteDelete(int index) { if (--index < 0) return; diff --git a/src/NadekoBot/Modules/Utility/Patronage/PatronageCommands.cs b/src/NadekoBot/Modules/Utility/Patronage/PatronageCommands.cs index c7f5585dd..d598d4dfd 100644 --- a/src/NadekoBot/Modules/Utility/Patronage/PatronageCommands.cs +++ b/src/NadekoBot/Modules/Utility/Patronage/PatronageCommands.cs @@ -18,19 +18,19 @@ public partial class Utility [Cmd] [Priority(2)] - public partial Task Patron() + public Task Patron() => InternalPatron(ctx.User); [Cmd] [Priority(0)] [OwnerOnly] - public partial Task Patron(IUser user) + public Task Patron(IUser user) => InternalPatron(user); [Cmd] [Priority(0)] [OwnerOnly] - public async partial Task PatronMessage(PatronTier tierAndHigher, string message) + public async Task PatronMessage(PatronTier tierAndHigher, string message) { _ = ctx.Channel.TriggerTypingAsync(); var result = await _service.SendMessageToPatronsAsync(tierAndHigher, message); @@ -43,7 +43,7 @@ public partial class Utility // [Cmd] // [OwnerOnly] - // public async partial Task PatronGift(IUser user, int amount) + // public async Task PatronGift(IUser user, int amount) // { // // i can't figure out a good way to gift more than one month at the moment. // diff --git a/src/NadekoBot/Modules/Utility/Quote/QuoteCommands.cs b/src/NadekoBot/Modules/Utility/Quote/QuoteCommands.cs index 7f5ac0816..8b781040a 100644 --- a/src/NadekoBot/Modules/Utility/Quote/QuoteCommands.cs +++ b/src/NadekoBot/Modules/Utility/Quote/QuoteCommands.cs @@ -44,13 +44,13 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task ListQuotes(OrderType order = OrderType.Keyword) + public Task ListQuotes(OrderType order = OrderType.Keyword) => ListQuotes(1, order); [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task ListQuotes(int page = 1, OrderType order = OrderType.Keyword) + public async Task ListQuotes(int page = 1, OrderType order = OrderType.Keyword) { page -= 1; if (page < 0) @@ -75,7 +75,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QuotePrint([Leftover] string keyword) + public async Task QuotePrint([Leftover] string keyword) { if (string.IsNullOrWhiteSpace(keyword)) return; @@ -106,7 +106,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QuoteShow(int id) + public async Task QuoteShow(int id) { Quote quote; await using (var uow = _db.GetDbContext()) @@ -160,18 +160,18 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public partial Task QuoteSearch(string textOrAuthor) + public Task QuoteSearch(string textOrAuthor) => QuoteSearchinternalAsync(null, textOrAuthor); [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task QuoteSearch(string keyword, [Leftover] string textOrAuthor) + public Task QuoteSearch(string keyword, [Leftover] string textOrAuthor) => QuoteSearchinternalAsync(keyword, textOrAuthor); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QuoteId(int id) + public async Task QuoteId(int id) { if (id < 0) return; @@ -203,7 +203,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QuoteAdd(string keyword, [Leftover] string text) + public async Task QuoteAdd(string keyword, [Leftover] string text) { if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text)) return; @@ -229,7 +229,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task QuoteDelete(int id) + public async Task QuoteDelete(int id) { var hasManageMessages = ((IGuildUser)ctx.Message.Author).GuildPermissions.ManageMessages; @@ -259,7 +259,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task DelAllQuotes([Leftover] string keyword) + public async Task DelAllQuotes([Leftover] string keyword) { if (string.IsNullOrWhiteSpace(keyword)) return; @@ -279,7 +279,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task QuotesExport() + public async Task QuotesExport() { IEnumerable quotes; await using (var uow = _db.GetDbContext()) @@ -303,7 +303,7 @@ public partial class Utility #if GLOBAL_NADEKO [OwnerOnly] #endif - public async partial Task QuotesImport([Leftover] string input = null) + public async Task QuotesImport([Leftover] string input = null) { input = input?.Trim(); diff --git a/src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs b/src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs index 384eb8e4e..9a7cd6125 100644 --- a/src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs +++ b/src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs @@ -37,7 +37,7 @@ public partial class Utility [Cmd] [Priority(1)] - public async partial Task Remind(MeOrHere meorhere, [Leftover] string remindString) + public async Task Remind(MeOrHere meorhere, [Leftover] string remindString) { if (!_service.TryParseRemindMessage(remindString, out var remindData)) { @@ -58,7 +58,7 @@ public partial class Utility [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(0)] - public async partial Task Remind(ITextChannel channel, [Leftover] string remindString) + public async Task Remind(ITextChannel channel, [Leftover] string remindString) { var perms = ((IGuildUser)ctx.User).GetPermissions(channel); if (!perms.SendMessages || !perms.ViewChannel) @@ -82,12 +82,12 @@ public partial class Utility [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(0)] - public partial Task RemindList(Server _, int page = 1) + public Task RemindList(Server _, int page = 1) => RemindListInternal(page, true); [Cmd] [Priority(1)] - public partial Task RemindList(int page = 1) + public Task RemindList(int page = 1) => RemindListInternal(page, false); private async Task RemindListInternal(int page, bool isServer) @@ -134,12 +134,12 @@ public partial class Utility [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] [Priority(0)] - public partial Task RemindDelete(Server _, int index) + public Task RemindDelete(Server _, int index) => RemindDelete(index, true); [Cmd] [Priority(1)] - public partial Task RemindDelete(int index) + public Task RemindDelete(int index) => RemindDelete(index, false); private async Task RemindDelete(int index, bool isServer) diff --git a/src/NadekoBot/Modules/Utility/Repeater/RepeatCommands.cs b/src/NadekoBot/Modules/Utility/Repeater/RepeatCommands.cs index cfe27b0ef..ddb9352b6 100644 --- a/src/NadekoBot/Modules/Utility/Repeater/RepeatCommands.cs +++ b/src/NadekoBot/Modules/Utility/Repeater/RepeatCommands.cs @@ -12,7 +12,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task RepeatInvoke(int index) + public async Task RepeatInvoke(int index) { if (--index < 0) return; @@ -25,7 +25,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task RepeatRemove(int index) + public async Task RepeatRemove(int index) { if (--index < 0) return; @@ -47,7 +47,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task RepeatRedundant(int index) + public async Task RepeatRedundant(int index) { if (--index < 0) return; @@ -70,28 +70,28 @@ public partial class Utility [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(-1)] - public partial Task Repeat([Leftover] string message) + public Task Repeat([Leftover] string message) => Repeat(null, null, message); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(0)] - public partial Task Repeat(StoopidTime interval, [Leftover] string message) + public Task Repeat(StoopidTime interval, [Leftover] string message) => Repeat(null, interval, message); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(1)] - public partial Task Repeat(GuildDateTime dt, [Leftover] string message) + public Task Repeat(GuildDateTime dt, [Leftover] string message) => Repeat(dt, null, message); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(2)] - public async partial Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message) + public async 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) @@ -134,7 +134,7 @@ public partial class Utility [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task RepeatList() + public async Task RepeatList() { var repeaters = _service.GetRepeaters(ctx.Guild.Id); if (repeaters.Count == 0) diff --git a/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleCommands.cs b/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleCommands.cs index 028127765..25c3710c0 100644 --- a/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleCommands.cs +++ b/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleCommands.cs @@ -12,7 +12,7 @@ public partial class Utility [BotPerm(GuildPerm.ManageRoles)] [UserPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task StreamRole(IRole fromRole, IRole addRole) + public async Task StreamRole(IRole fromRole, IRole addRole) { await _service.SetStreamRole(fromRole, addRole); @@ -24,7 +24,7 @@ public partial class Utility [BotPerm(GuildPerm.ManageRoles)] [UserPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task StreamRole() + public async Task StreamRole() { await _service.StopStreamRole(ctx.Guild); await ReplyConfirmLocalizedAsync(strs.stream_role_disabled); @@ -34,7 +34,7 @@ public partial class Utility [BotPerm(GuildPerm.ManageRoles)] [UserPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task StreamRoleKeyword([Leftover] string keyword = null) + public async Task StreamRoleKeyword([Leftover] string keyword = null) { var kw = await _service.SetKeyword(ctx.Guild, keyword); @@ -48,7 +48,7 @@ public partial class Utility [BotPerm(GuildPerm.ManageRoles)] [UserPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user) + public async Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user) { var success = await _service.ApplyListAction(StreamRoleListType.Blacklist, ctx.Guild, @@ -73,7 +73,7 @@ public partial class Utility [BotPerm(GuildPerm.ManageRoles)] [UserPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user) + public async Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user) { var success = await _service.ApplyListAction(StreamRoleListType.Whitelist, ctx.Guild, diff --git a/src/NadekoBot/Modules/Utility/UnitConversion/UnitConversionCommands.cs b/src/NadekoBot/Modules/Utility/UnitConversion/UnitConversionCommands.cs index 54875203e..a6baf19ec 100644 --- a/src/NadekoBot/Modules/Utility/UnitConversion/UnitConversionCommands.cs +++ b/src/NadekoBot/Modules/Utility/UnitConversion/UnitConversionCommands.cs @@ -9,7 +9,7 @@ public partial class Utility public partial class UnitConverterCommands : NadekoModule { [Cmd] - public async partial Task ConvertList() + public async Task ConvertList() { var units = await _service.GetUnitsAsync(); @@ -27,7 +27,7 @@ public partial class Utility [Cmd] [Priority(0)] - public async partial Task Convert(string origin, string target, decimal value) + public async Task Convert(string origin, string target, decimal value) { var units = await _service.GetUnitsAsync(); var originUnit = units.FirstOrDefault(x diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 73182f7f9..1849f0066 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -60,7 +60,7 @@ public partial class Utility : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(1)] - public async partial Task Say(ITextChannel channel, [Leftover] SmartText message) + public async Task Say(ITextChannel channel, [Leftover] SmartText message) { var rep = new ReplacementBuilder() .WithDefault(ctx.User, channel, (SocketGuild)ctx.Guild, (DiscordSocketClient)ctx.Client) @@ -75,12 +75,12 @@ public partial class Utility : NadekoModule [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] [Priority(0)] - public partial Task Say([Leftover] SmartText message) + public Task Say([Leftover] SmartText message) => Say((ITextChannel)ctx.Channel, message); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task WhosPlaying([Leftover] string game) + public async Task WhosPlaying([Leftover] string game) { game = game?.Trim().ToUpperInvariant(); if (string.IsNullOrWhiteSpace(game)) @@ -117,7 +117,7 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(0)] - public async partial Task InRole(int page, [Leftover] IRole role = null) + public async Task InRole(int page, [Leftover] IRole role = null) { if (--page < 0) return; @@ -153,12 +153,12 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [Priority(1)] - public partial Task InRole([Leftover] IRole role = null) + public Task InRole([Leftover] IRole role = null) => InRole(1, role); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task CheckPerms(MeOrBot who = MeOrBot.Me) + public async Task CheckPerms(MeOrBot who = MeOrBot.Me) { var builder = new StringBuilder(); var user = who == MeOrBot.Me ? (IGuildUser)ctx.User : ((SocketGuild)ctx.Guild).CurrentUser; @@ -178,7 +178,7 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task UserId([Leftover] IGuildUser target = null) + public async Task UserId([Leftover] IGuildUser target = null) { var usr = target ?? ctx.User; await ReplyConfirmLocalizedAsync(strs.userid("🆔", @@ -188,23 +188,23 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task RoleId([Leftover] IRole role) + public async Task RoleId([Leftover] IRole role) => await ReplyConfirmLocalizedAsync(strs.roleid("🆔", Format.Bold(role.ToString()), Format.Code(role.Id.ToString()))); [Cmd] - public async partial Task ChannelId() + public async Task ChannelId() => await ReplyConfirmLocalizedAsync(strs.channelid("🆔", Format.Code(ctx.Channel.Id.ToString()))); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task ServerId() + public async Task ServerId() => await ReplyConfirmLocalizedAsync(strs.serverid("🆔", Format.Code(ctx.Guild.Id.ToString()))); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Roles(IGuildUser target, int page = 1) + public async Task Roles(IGuildUser target, int page = 1) { var guild = ctx.Guild; @@ -248,12 +248,12 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public partial Task Roles(int page = 1) + public Task Roles(int page = 1) => Roles(null, page); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task ChannelTopic([Leftover] ITextChannel channel = null) + public async Task ChannelTopic([Leftover] ITextChannel channel = null) { if (channel is null) channel = (ITextChannel)ctx.Channel; @@ -266,7 +266,7 @@ public partial class Utility : NadekoModule } [Cmd] - public async partial Task Stats() + public async Task Stats() { var ownerIds = string.Join("\n", _creds.OwnerIds); if (string.IsNullOrWhiteSpace(ownerIds)) @@ -299,7 +299,7 @@ public partial class Utility : NadekoModule } [Cmd] - public async partial Task + public async 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); @@ -317,7 +317,7 @@ public partial class Utility : NadekoModule [BotPerm(GuildPerm.ManageEmojisAndStickers)] [UserPerm(GuildPerm.ManageEmojisAndStickers)] [Priority(2)] - public partial Task EmojiAdd(string name, Emote emote) + public Task EmojiAdd(string name, Emote emote) => EmojiAdd(name, emote.Url); [Cmd] @@ -325,7 +325,7 @@ public partial class Utility : NadekoModule [BotPerm(GuildPerm.ManageEmojisAndStickers)] [UserPerm(GuildPerm.ManageEmojisAndStickers)] [Priority(1)] - public partial Task EmojiAdd(Emote emote) + public Task EmojiAdd(Emote emote) => EmojiAdd(emote.Name, emote.Url); [Cmd] @@ -333,7 +333,7 @@ public partial class Utility : NadekoModule [BotPerm(GuildPerm.ManageEmojisAndStickers)] [UserPerm(GuildPerm.ManageEmojisAndStickers)] [Priority(0)] - public async partial Task EmojiAdd(string name, string url = null) + public async Task EmojiAdd(string name, string url = null) { name = name.Trim(':'); @@ -369,7 +369,7 @@ public partial class Utility : NadekoModule [Cmd] [OwnerOnly] - public async partial Task ListServers(int page = 1) + public async Task ListServers(int page = 1) { page -= 1; @@ -396,12 +396,12 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public partial Task ShowEmbed(ulong messageId) + public Task ShowEmbed(ulong messageId) => ShowEmbed((ITextChannel)ctx.Channel, messageId); [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task ShowEmbed(ITextChannel ch, ulong messageId) + public async Task ShowEmbed(ITextChannel ch, ulong messageId) { var user = (IGuildUser)ctx.User; var perms = user.GetPermissions(ch); @@ -432,7 +432,7 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task SaveChat(int cnt) + public async Task SaveChat(int cnt) { var msgs = new List(cnt); await ctx.Channel.GetMessagesAsync(cnt).ForEachAsync(dled => msgs.AddRange(dled)); @@ -472,7 +472,7 @@ public partial class Utility : NadekoModule } [Cmd] - public async partial Task Ping() + public async Task Ping() { await sem.WaitAsync(5000); try @@ -493,7 +493,7 @@ public partial class Utility : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.ManageMessages)] - public async partial Task VerboseError(bool? newstate = null) + public async Task VerboseError(bool? newstate = null) { var state = _veService.ToggleVerboseErrors(ctx.Guild.Id, newstate); diff --git a/src/NadekoBot/Modules/Utility/VerboseErrors/EvalCommands.cs b/src/NadekoBot/Modules/Utility/VerboseErrors/EvalCommands.cs index 03d29b9aa..2c2b1aeb4 100644 --- a/src/NadekoBot/Modules/Utility/VerboseErrors/EvalCommands.cs +++ b/src/NadekoBot/Modules/Utility/VerboseErrors/EvalCommands.cs @@ -19,7 +19,7 @@ public partial class Utility [Cmd] [NoPublicBot] [OwnerOnly] - public async partial Task Eval([Leftover] string scriptText) + public async Task Eval([Leftover] string scriptText) { _ = ctx.Channel.TriggerTypingAsync(); diff --git a/src/NadekoBot/Modules/Xp/Club/Club.cs b/src/NadekoBot/Modules/Xp/Club/Club.cs index 8b510f8dc..a261caedc 100644 --- a/src/NadekoBot/Modules/Xp/Club/Club.cs +++ b/src/NadekoBot/Modules/Xp/Club/Club.cs @@ -15,7 +15,7 @@ public partial class Xp => _xps = xps; [Cmd] - public async partial Task ClubTransfer([Leftover] IUser newOwner) + public async Task ClubTransfer([Leftover] IUser newOwner) { var club = _service.TransferClub(ctx.User, newOwner); @@ -35,7 +35,7 @@ public partial class Xp } [Cmd] - public async partial Task ClubAdmin([Leftover] IUser toAdmin) + public async Task ClubAdmin([Leftover] IUser toAdmin) { var admin = await _service.ToggleAdminAsync(ctx.User, toAdmin); @@ -47,7 +47,7 @@ public partial class Xp await ReplyConfirmLocalizedAsync(strs.club_admin_remove(Format.Bold(toAdmin.ToString()))); } [Cmd] - public async partial Task ClubCreate([Leftover] string clubName) + public async Task ClubCreate([Leftover] string clubName) { if (string.IsNullOrWhiteSpace(clubName) || clubName.Length > 20) { @@ -73,7 +73,7 @@ public partial class Xp } [Cmd] - public async partial Task ClubIcon([Leftover] string url = null) + public async Task ClubIcon([Leftover] string url = null) { if ((!Uri.IsWellFormedUriString(url, UriKind.Absolute) && url is not null) || !await _service.SetClubIconAsync(ctx.User.Id, url)) @@ -135,7 +135,7 @@ public partial class Xp [Cmd] [Priority(1)] - public async partial Task ClubInformation(IUser user = null) + public async Task ClubInformation(IUser user = null) { user ??= ctx.User; var club = _service.GetClubByMember(user); @@ -150,7 +150,7 @@ public partial class Xp [Cmd] [Priority(0)] - public async partial Task ClubInformation([Leftover] string clubName = null) + public async Task ClubInformation([Leftover] string clubName = null) { if (string.IsNullOrWhiteSpace(clubName)) { @@ -168,7 +168,7 @@ public partial class Xp } [Cmd] - public partial Task ClubBans(int page = 1) + public Task ClubBans(int page = 1) { if (--page < 0) return Task.CompletedTask; @@ -194,7 +194,7 @@ public partial class Xp } [Cmd] - public partial Task ClubApps(int page = 1) + public Task ClubApps(int page = 1) { if (--page < 0) return Task.CompletedTask; @@ -220,7 +220,7 @@ public partial class Xp } [Cmd] - public async partial Task ClubApply([Leftover] string clubName) + public async Task ClubApply([Leftover] string clubName) { if (string.IsNullOrWhiteSpace(clubName)) return; @@ -239,12 +239,12 @@ public partial class Xp [Cmd] [Priority(1)] - public partial Task ClubAccept(IUser user) + public Task ClubAccept(IUser user) => ClubAccept(user.ToString()); [Cmd] [Priority(0)] - public async partial Task ClubAccept([Leftover] string userName) + public async Task ClubAccept([Leftover] string userName) { if (_service.AcceptApplication(ctx.User.Id, userName, out var discordUser)) await ReplyConfirmLocalizedAsync(strs.club_accepted(Format.Bold(discordUser.ToString()))); @@ -253,7 +253,7 @@ public partial class Xp } [Cmd] - public async partial Task Clubleave() + public async Task Clubleave() { if (_service.LeaveClub(ctx.User)) await ReplyConfirmLocalizedAsync(strs.club_left); @@ -263,12 +263,12 @@ public partial class Xp [Cmd] [Priority(1)] - public partial Task ClubKick([Leftover] IUser user) + public Task ClubKick([Leftover] IUser user) => ClubKick(user.ToString()); [Cmd] [Priority(0)] - public partial Task ClubKick([Leftover] string userName) + public Task ClubKick([Leftover] string userName) { if (_service.Kick(ctx.User.Id, userName, out var club)) { @@ -281,12 +281,12 @@ public partial class Xp [Cmd] [Priority(1)] - public partial Task ClubBan([Leftover] IUser user) + public Task ClubBan([Leftover] IUser user) => ClubBan(user.ToString()); [Cmd] [Priority(0)] - public partial Task ClubBan([Leftover] string userName) + public Task ClubBan([Leftover] string userName) { if (_service.Ban(ctx.User.Id, userName, out var club)) { @@ -299,12 +299,12 @@ public partial class Xp [Cmd] [Priority(1)] - public partial Task ClubUnBan([Leftover] IUser user) + public Task ClubUnBan([Leftover] IUser user) => ClubUnBan(user.ToString()); [Cmd] [Priority(0)] - public partial Task ClubUnBan([Leftover] string userName) + public Task ClubUnBan([Leftover] string userName) { if (_service.UnBan(ctx.User.Id, userName, out var club)) { @@ -316,7 +316,7 @@ public partial class Xp } [Cmd] - public async partial Task ClubDescription([Leftover] string desc = null) + public async Task ClubDescription([Leftover] string desc = null) { if (_service.SetDescription(ctx.User.Id, desc)) { @@ -339,7 +339,7 @@ public partial class Xp } [Cmd] - public async partial Task ClubDisband() + public async Task ClubDisband() { if (_service.Disband(ctx.User.Id, out var club)) await ReplyConfirmLocalizedAsync(strs.club_disbanded(Format.Bold(club.Name))); @@ -348,7 +348,7 @@ public partial class Xp } [Cmd] - public partial Task ClubLeaderboard(int page = 1) + public Task ClubLeaderboard(int page = 1) { if (--page < 0) return Task.CompletedTask; diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/NadekoBot/Modules/Xp/Xp.cs index 13ee90a2d..45e1b3c83 100644 --- a/src/NadekoBot/Modules/Xp/Xp.cs +++ b/src/NadekoBot/Modules/Xp/Xp.cs @@ -33,7 +33,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task Experience([Leftover] IUser user = null) + public async Task Experience([Leftover] IUser user = null) { user ??= ctx.User; await ctx.Channel.TriggerTypingAsync(); @@ -46,7 +46,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task XpNotify() + public async Task XpNotify() { var globalSetting = _service.GetNotificationType(ctx.User); var serverSetting = _service.GetNotificationType(ctx.User.Id, ctx.Guild.Id); @@ -61,7 +61,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task XpNotify(NotifyPlace place, XpNotificationLocation type) + public async Task XpNotify(NotifyPlace place, XpNotificationLocation type) { if (place == NotifyPlace.Guild) await _service.ChangeNotificationType(ctx.User.Id, ctx.Guild.Id, type); @@ -74,7 +74,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task XpExclude(Server _) + public async Task XpExclude(Server _) { var ex = _service.ToggleExcludeServer(ctx.Guild.Id); @@ -87,7 +87,7 @@ public partial class Xp : NadekoModule [Cmd] [UserPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] - public async partial Task XpExclude(Role _, [Leftover] IRole role) + public async Task XpExclude(Role _, [Leftover] IRole role) { var ex = _service.ToggleExcludeRole(ctx.Guild.Id, role.Id); @@ -100,7 +100,7 @@ public partial class Xp : NadekoModule [Cmd] [UserPerm(GuildPerm.ManageChannels)] [RequireContext(ContextType.Guild)] - public async partial Task XpExclude(Channel _, [Leftover] IChannel channel = null) + public async Task XpExclude(Channel _, [Leftover] IChannel channel = null) { if (channel is null) channel = ctx.Channel; @@ -115,7 +115,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task XpExclusionList() + public async Task XpExclusionList() { var serverExcluded = _service.IsServerExcluded(ctx.Guild.Id); var roles = _service.GetExcludedRoles(ctx.Guild.Id) @@ -157,14 +157,14 @@ public partial class Xp : NadekoModule [NadekoOptions(typeof(LbOpts))] [Priority(0)] [RequireContext(ContextType.Guild)] - public partial Task XpLeaderboard(params string[] args) + public Task XpLeaderboard(params string[] args) => XpLeaderboard(1, args); [Cmd] [NadekoOptions(typeof(LbOpts))] [Priority(1)] [RequireContext(ContextType.Guild)] - public async partial Task XpLeaderboard(int page = 1, params string[] args) + public async Task XpLeaderboard(int page = 1, params string[] args) { if (--page < 0 || page > 100) return; @@ -225,7 +225,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] - public async partial Task XpGlobalLeaderboard(int page = 1) + public async Task XpGlobalLeaderboard(int page = 1) { if (--page < 0 || page > 99) return; @@ -251,7 +251,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task XpAdd(int amount, ulong userId) + public async Task XpAdd(int amount, ulong userId) { if (amount == 0) return; @@ -264,13 +264,13 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public partial Task XpAdd(int amount, [Leftover] IGuildUser user) + public Task XpAdd(int amount, [Leftover] IGuildUser user) => XpAdd(amount, user.Id); [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task XpTemplateReload() + public async Task XpTemplateReload() { _service.ReloadXpTemplate(); await Task.Delay(1000); @@ -280,13 +280,13 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public partial Task XpReset(IGuildUser user) + public Task XpReset(IGuildUser user) => XpReset(user.Id); [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task XpReset(ulong userId) + public async Task XpReset(ulong userId) { var embed = _eb.Create().WithTitle(GetText(strs.reset)).WithDescription(GetText(strs.reset_user_confirm)); @@ -301,7 +301,7 @@ public partial class Xp : NadekoModule [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task XpReset() + public async Task XpReset() { var embed = _eb.Create().WithTitle(GetText(strs.reset)).WithDescription(GetText(strs.reset_server_confirm)); diff --git a/src/NadekoBot/Modules/Xp/XpRewards.cs b/src/NadekoBot/Modules/Xp/XpRewards.cs index 934c49086..f25056b43 100644 --- a/src/NadekoBot/Modules/Xp/XpRewards.cs +++ b/src/NadekoBot/Modules/Xp/XpRewards.cs @@ -15,7 +15,7 @@ public partial class Xp [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] - public async partial Task XpRewsReset() + public async Task XpRewsReset() { var promptEmbed = _eb.Create() .WithPendingColor() @@ -32,7 +32,7 @@ public partial class Xp [Cmd] [RequireContext(ContextType.Guild)] - public partial Task XpLevelUpRewards(int page = 1) + public Task XpLevelUpRewards(int page = 1) { page--; @@ -92,7 +92,7 @@ public partial class Xp [BotPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] [Priority(2)] - public async partial Task XpRoleReward(int level) + public async Task XpRoleReward(int level) { _service.ResetRoleReward(ctx.Guild.Id, level); await ReplyConfirmLocalizedAsync(strs.xp_role_reward_cleared(level)); @@ -103,7 +103,7 @@ public partial class Xp [BotPerm(GuildPerm.ManageRoles)] [RequireContext(ContextType.Guild)] [Priority(1)] - public async partial Task XpRoleReward(int level, AddRemove action, [Leftover] IRole role) + public async Task XpRoleReward(int level, AddRemove action, [Leftover] IRole role) { if (level < 1) return; @@ -121,7 +121,7 @@ public partial class Xp [Cmd] [RequireContext(ContextType.Guild)] [OwnerOnly] - public async partial Task XpCurrencyReward(int level, int amount = 0) + public async Task XpCurrencyReward(int level, int amount = 0) { if (level < 1 || amount < 0) return; diff --git a/src/NadekoBot/Modules/Xp/XpService.cs b/src/NadekoBot/Modules/Xp/XpService.cs index f3f131ef3..696776f50 100644 --- a/src/NadekoBot/Modules/Xp/XpService.cs +++ b/src/NadekoBot/Modules/Xp/XpService.cs @@ -653,7 +653,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand { Guild = channel.Guild, User = user, - XpAmount = actualXp + XpAmount = actualXp, }); } } @@ -862,24 +862,6 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand public Task<(Stream Image, IImageFormat Format)> GenerateXpImageAsync(FullUserStats stats) => Task.Run(async () => { - var usernameTextOptions = new TextGraphicsOptions - { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Left, - VerticalAlignment = VerticalAlignment.Center - } - }.WithFallbackFonts(_fonts.FallBackFonts); - - var clubTextOptions = new TextGraphicsOptions - { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Right, - VerticalAlignment = VerticalAlignment.Top - } - }.WithFallbackFonts(_fonts.FallBackFonts); - using var img = Image.Load(await GetXpBackgroundAsync(stats.User.UserId), out var imageFormat); if (template.User.Name.Show) { @@ -894,11 +876,15 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand img.Mutate(x => { - x.DrawText(usernameTextOptions, + x.DrawText(new TextOptions(usernameFont) + { + HorizontalAlignment = HorizontalAlignment.Left, + VerticalAlignment = VerticalAlignment.Center, + FallbackFontFamilies = _fonts.FallBackFonts, + Origin = new(template.User.Name.Pos.X, template.User.Name.Pos.Y + 8) + }, "@" + username, - usernameFont, - template.User.Name.Color, - new(template.User.Name.Pos.X, template.User.Name.Pos.Y + 8)); + template.User.Name.Color); }); } @@ -910,11 +896,15 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand var clubFont = _fonts.NotoSans.CreateFont(template.Club.Name.FontSize, FontStyle.Regular); - img.Mutate(x => x.DrawText(clubTextOptions, + img.Mutate(x => x.DrawText(new TextOptions(clubFont) + { + HorizontalAlignment = HorizontalAlignment.Right, + VerticalAlignment = VerticalAlignment.Top, + FallbackFontFamilies = _fonts.FallBackFonts, + Origin = new(template.Club.Name.Pos.X + 50, template.Club.Name.Pos.Y - 8) + }, clubName, - clubFont, - template.Club.Name.Color, - new(template.Club.Name.Pos.X + 50, template.Club.Name.Pos.Y - 8))); + template.Club.Name.Color)); } Font GetTruncatedFont( @@ -989,37 +979,29 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand if (template.User.Xp.Global.Show) { img.Mutate(x => x.DrawText( - new() + new TextOptions(_fonts.NotoSans.CreateFont(template.User.Xp.Global.FontSize, FontStyle.Bold)) { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center - } + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Origin = new(template.User.Xp.Global.Pos.X, template.User.Xp.Global.Pos.Y), }, $"{global.LevelXp}/{global.RequiredXp}", - _fonts.NotoSans.CreateFont(template.User.Xp.Global.FontSize, FontStyle.Bold), Brushes.Solid(template.User.Xp.Global.Color), - pen, - new(template.User.Xp.Global.Pos.X, template.User.Xp.Global.Pos.Y))); + pen)); } if (template.User.Xp.Guild.Show) { img.Mutate(x => x.DrawText( - new() + new TextOptions(_fonts.NotoSans.CreateFont(template.User.Xp.Guild.FontSize, FontStyle.Bold)) { - TextOptions = new() - { - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center - } + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Origin = new(template.User.Xp.Guild.Pos.X, template.User.Xp.Guild.Pos.Y) }, $"{guild.LevelXp}/{guild.RequiredXp}", - _fonts.NotoSans.CreateFont(template.User.Xp.Guild.FontSize, FontStyle.Bold), Brushes.Solid(template.User.Xp.Guild.Color), - pen, - new(template.User.Xp.Guild.Pos.X, template.User.Xp.Guild.Pos.Y))); + pen)); } if (stats.FullGuildStats.AwardedXp != 0 && template.User.Xp.Awarded.Show) @@ -1083,14 +1065,14 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand using (var http = _httpFactory.CreateClient()) { var avatarData = await http.GetByteArrayAsync(avatarUrl); - using (var tempDraw = Image.Load(avatarData)) + using (var tempDraw = Image.Load(avatarData)) { tempDraw.Mutate(x => x .Resize(template.User.Icon.Size.X, template.User.Icon.Size.Y) .ApplyRoundedCorners(Math.Max(template.User.Icon.Size.X, template.User.Icon.Size.Y) / 2.0f)); - await using (var stream = tempDraw.ToStream()) + await using (var stream = await tempDraw.ToStreamAsync()) { data = stream.ToArray(); } @@ -1217,14 +1199,14 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand return; var imgData = await temp.Content.ReadAsByteArrayAsync(); - using (var tempDraw = Image.Load(imgData)) + using (var tempDraw = Image.Load(imgData)) { tempDraw.Mutate(x => x .Resize(template.Club.Icon.Size.X, template.Club.Icon.Size.Y) .ApplyRoundedCorners(Math.Max(template.Club.Icon.Size.X, template.Club.Icon.Size.Y) / 2.0f)); - await using (var tds = tempDraw.ToStream()) + await using (var tds = await tempDraw.ToStreamAsync()) { data = tds.ToArray(); } diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index 281145f5e..4cf3b660e 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -19,22 +19,22 @@ - + all True - + - - - - + + + + - + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -53,14 +53,16 @@ - - - + + + - - - + + + + + @@ -71,16 +73,16 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/NadekoBot/Services/Impl/FontProvider.cs b/src/NadekoBot/Services/Impl/FontProvider.cs index 5519f576b..e3bc13477 100644 --- a/src/NadekoBot/Services/Impl/FontProvider.cs +++ b/src/NadekoBot/Services/Impl/FontProvider.cs @@ -24,8 +24,8 @@ public class FontProvider : INService { _fonts = new(); - NotoSans = _fonts.Install("data/fonts/NotoSans-Bold.ttf"); - UniSans = _fonts.Install("data/fonts/Uni Sans.ttf"); + NotoSans = _fonts.Add("data/fonts/NotoSans-Bold.ttf"); + UniSans = _fonts.Add("data/fonts/Uni Sans.ttf"); FallBackFonts = new(); @@ -37,9 +37,9 @@ public class FontProvider : INService try { var fontsfolder = Environment.GetFolderPath(Environment.SpecialFolder.Fonts); - FallBackFonts.Add(_fonts.Install(Path.Combine(fontsfolder, "seguiemj.ttf"))); - FallBackFonts.AddRange(_fonts.InstallCollection(Path.Combine(fontsfolder, "msgothic.ttc"))); - FallBackFonts.AddRange(_fonts.InstallCollection(Path.Combine(fontsfolder, "segoe.ttc"))); + FallBackFonts.Add(_fonts.Add(Path.Combine(fontsfolder, "seguiemj.ttf"))); + FallBackFonts.AddRange(_fonts.AddCollection(Path.Combine(fontsfolder, "msgothic.ttc"))); + FallBackFonts.AddRange(_fonts.AddCollection(Path.Combine(fontsfolder, "segoe.ttc"))); } catch { } } @@ -49,9 +49,9 @@ public class FontProvider : INService foreach (var font in Directory.GetFiles(@"data/fonts")) { if (font.EndsWith(".ttf")) - FallBackFonts.Add(_fonts.Install(font)); + FallBackFonts.Add(_fonts.Add(font)); else if (font.EndsWith(".ttc")) - FallBackFonts.AddRange(_fonts.InstallCollection(font)); + FallBackFonts.AddRange(_fonts.AddCollection(font)); } RipFont = NotoSans.CreateFont(20, FontStyle.Bold); diff --git a/src/NadekoBot/_Extensions/ImagesharpExtensions.cs b/src/NadekoBot/_Extensions/ImagesharpExtensions.cs index aa501000e..1386c3b7c 100644 --- a/src/NadekoBot/_Extensions/ImagesharpExtensions.cs +++ b/src/NadekoBot/_Extensions/ImagesharpExtensions.cs @@ -12,32 +12,6 @@ namespace NadekoBot.Extensions; public static class ImagesharpExtensions { - /// - /// Adds fallback fonts to - /// - /// to which fallback fonts will be added to - /// List of fallback Font Families to add - /// The same to allow chaining - public static TextOptions WithFallbackFonts(this TextOptions opts, List fallback) - { - foreach (var ff in fallback) - opts.FallbackFonts.Add(ff); - - return opts; - } - - /// - /// Adds fallback fonts to - /// - /// to which fallback fonts will be added to - /// List of fallback Font Families to add - /// The same to allow chaining - public static TextGraphicsOptions WithFallbackFonts(this TextGraphicsOptions opts, List fallback) - { - opts.TextOptions.WithFallbackFonts(fallback); - return opts; - } - // https://github.com/SixLabors/Samples/blob/master/ImageSharp/AvatarWithRoundedCorner/Program.cs public static IImageProcessingContext ApplyRoundedCorners(this IImageProcessingContext ctx, float cornerRadius) { @@ -93,7 +67,7 @@ public static class ImagesharpExtensions new() { ColorType = PngColorType.RgbWithAlpha, - CompressionLevel = PngCompressionLevel.BestCompression + CompressionLevel = PngCompressionLevel.DefaultCompression }); }