diff --git a/CompatBot/Commands/Attributes/LimitedToHelpChannel.cs b/CompatBot/Commands/Attributes/LimitedToHelpChannel.cs index 41961634..ccdc2fab 100644 --- a/CompatBot/Commands/Attributes/LimitedToHelpChannel.cs +++ b/CompatBot/Commands/Attributes/LimitedToHelpChannel.cs @@ -16,7 +16,7 @@ namespace CompatBot.Commands.Attributes if (ctx.Channel.Name.Equals("help", StringComparison.InvariantCultureIgnoreCase)) return true; - await ctx.RespondAsync($"`{ctx.Prefix}{ctx.Command.QualifiedName}` is limited to help channel and DMs").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"`{ctx.Prefix}{ctx.Command.QualifiedName}` is limited to help channel and DMs").ConfigureAwait(false); return false; } } diff --git a/CompatBot/Commands/Attributes/LimitedToOfftopicChannel.cs b/CompatBot/Commands/Attributes/LimitedToOfftopicChannel.cs index 2a1739da..cd0f1e2c 100644 --- a/CompatBot/Commands/Attributes/LimitedToOfftopicChannel.cs +++ b/CompatBot/Commands/Attributes/LimitedToOfftopicChannel.cs @@ -30,7 +30,7 @@ namespace CompatBot.Commands.Attributes } catch {} - await ctx.RespondAsync($"`{ctx.Prefix}{ctx.Command.QualifiedName}` is limited to off-topic channels and DMs").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"`{ctx.Prefix}{ctx.Command.QualifiedName}` is limited to off-topic channels and DMs").ConfigureAwait(false); return false; } diff --git a/CompatBot/Commands/Attributes/LimitedToSpamChannel.cs b/CompatBot/Commands/Attributes/LimitedToSpamChannel.cs index 4cf5e902..2c2d9281 100644 --- a/CompatBot/Commands/Attributes/LimitedToSpamChannel.cs +++ b/CompatBot/Commands/Attributes/LimitedToSpamChannel.cs @@ -31,7 +31,7 @@ namespace CompatBot.Commands.Attributes catch {} var spamChannel = await ctx.Client.GetChannelAsync(Config.BotSpamId).ConfigureAwait(false); - await ctx.RespondAsync($"`{ctx.Prefix}{ctx.Command.QualifiedName}` is limited to {spamChannel.Mention} and DMs").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"`{ctx.Prefix}{ctx.Command.QualifiedName}` is limited to {spamChannel.Mention} and DMs").ConfigureAwait(false); return false; } diff --git a/CompatBot/Commands/Attributes/RequiresDm.cs b/CompatBot/Commands/Attributes/RequiresDm.cs index 9242044b..5d21814d 100644 --- a/CompatBot/Commands/Attributes/RequiresDm.cs +++ b/CompatBot/Commands/Attributes/RequiresDm.cs @@ -24,7 +24,7 @@ namespace CompatBot.Commands.Attributes return true; await using var stream = new MemoryStream(Poster.Value); - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile("senpai_plz.jpg", stream)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("senpai_plz.jpg", stream)).ConfigureAwait(false); return false; } } diff --git a/CompatBot/Commands/BaseCommandModuleCustom.cs b/CompatBot/Commands/BaseCommandModuleCustom.cs index 7fd73209..73f52d6e 100644 --- a/CompatBot/Commands/BaseCommandModuleCustom.cs +++ b/CompatBot/Commands/BaseCommandModuleCustom.cs @@ -48,7 +48,7 @@ namespace CompatBot.Commands var disabledCmds = DisabledCommandsProvider.Get(); if (disabledCmds.Contains(ctx.Command.QualifiedName) && !disabledCmds.Contains("*")) { - await ctx.RespondAsync(embed: new DiscordEmbedBuilder {Color = Config.Colors.Maintenance, Description = "Command is currently disabled"}).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: new DiscordEmbedBuilder {Color = Config.Colors.Maintenance, Description = "Command is currently disabled"}).ConfigureAwait(false); Config.TelemetryClient?.TrackRequest(ctx.Command.QualifiedName, executionStart, DateTimeOffset.UtcNow - executionStart, HttpStatusCode.Locked.ToString(), true); throw new DSharpPlus.CommandsNext.Exceptions.ChecksFailedException(ctx.Command, ctx, new CheckBaseAttribute[] {new RequiresDm()}); } diff --git a/CompatBot/Commands/BotMath.cs b/CompatBot/Commands/BotMath.cs index 5ddac1fa..278b66c8 100644 --- a/CompatBot/Commands/BotMath.cs +++ b/CompatBot/Commands/BotMath.cs @@ -38,12 +38,12 @@ namespace CompatBot.Commands { Config.Log.Warn(e, "Math failed"); } - await ctx.RespondAsync(result).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(result).ConfigureAwait(false); } [Command("help"), LimitedToSpamChannel, Cooldown(1, 5, CooldownBucketType.Channel)] [Description("General math expression help, or description of specific math word")] public Task Help(CommandContext ctx) - => ctx.RespondAsync("Help for all the features and built-in constants and functions could be found at "); + => ctx.Channel.SendMessageAsync("Help for all the features and built-in constants and functions could be found at "); } } \ No newline at end of file diff --git a/CompatBot/Commands/CommandsManagement.cs b/CompatBot/Commands/CommandsManagement.cs index 1907df32..6620b138 100644 --- a/CompatBot/Commands/CommandsManagement.cs +++ b/CompatBot/Commands/CommandsManagement.cs @@ -28,7 +28,7 @@ namespace CompatBot.Commands await ctx.SendAutosplitMessageAsync(result.Append("```")).ConfigureAwait(false); } else - await ctx.RespondAsync("All commands are enabled").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("All commands are enabled").ConfigureAwait(false); } [Command("disable"), Aliases("add")] @@ -69,7 +69,7 @@ namespace CompatBot.Commands else DisableSubcommands(ctx, cmd); if (ctx.Command.Parent.QualifiedName.StartsWith(command)) - await ctx.RespondAsync("Some subcommands cannot be disabled").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Some subcommands cannot be disabled").ConfigureAwait(false); else await ctx.ReactWithAsync(Config.Reactions.Success, $"Disabled `{command}` and all subcommands").ConfigureAwait(false); await List(ctx).ConfigureAwait(false); @@ -77,7 +77,7 @@ namespace CompatBot.Commands catch (Exception e) { Config.Log.Error(e); - await ctx.RespondAsync("Error while disabling the group").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Error while disabling the group").ConfigureAwait(false); } } else @@ -134,7 +134,7 @@ namespace CompatBot.Commands catch (Exception e) { Config.Log.Error(e); - await ctx.RespondAsync("Error while enabling the group").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Error while enabling the group").ConfigureAwait(false); } } else diff --git a/CompatBot/Commands/CompatList.cs b/CompatBot/Commands/CompatList.cs index 6b98866c..00769735 100644 --- a/CompatBot/Commands/CompatList.cs +++ b/CompatBot/Commands/CompatList.cs @@ -73,7 +73,7 @@ namespace CompatBot.Commands title = title?.TrimEager().Truncate(40); if (string.IsNullOrEmpty(title)) { - var prompt = await ctx.RespondAsync($"{ctx.Message.Author.Mention} what game do you want to check?").ConfigureAwait(false); + var prompt = await ctx.Channel.SendMessageAsync($"{ctx.Message.Author.Mention} what game do you want to check?").ConfigureAwait(false); var interact = ctx.Client.GetInteractivity(); var response = await interact.WaitForMessageAsync(m => m.Author == ctx.Message.Author && m.Channel == ctx.Channel).ConfigureAwait(false); if (string.IsNullOrEmpty(response.Result?.Content) || response.Result.Content.StartsWith(Config.CommandPrefix)) @@ -161,7 +161,7 @@ namespace CompatBot.Commands await ctx.SendAutosplitMessageAsync(result, blockStart: null, blockEnd: null).ConfigureAwait(false); } else - await ctx.RespondAsync("Failed to generate list").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Failed to generate list").ConfigureAwait(false); } [Group("latest"), TriggersTyping] @@ -420,7 +420,7 @@ namespace CompatBot.Commands { if (result == null) { - await ctx.RespondAsync(embed: TitleInfo.CommunicationError.AsEmbed(null)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: TitleInfo.CommunicationError.AsEmbed(null)).ConfigureAwait(false); return; } } diff --git a/CompatBot/Commands/ContentFilters.cs b/CompatBot/Commands/ContentFilters.cs index ace199d9..6f5c6366 100644 --- a/CompatBot/Commands/ContentFilters.cs +++ b/CompatBot/Commands/ContentFilters.cs @@ -93,7 +93,7 @@ namespace CompatBot.Commands await using (var writer = new StreamWriter(output, leaveOpen: true)) await writer.WriteAsync(result.ToString()).ConfigureAwait(false); output.Seek(0, SeekOrigin.Begin); - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile("filters.txt", output)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("filters.txt", output)).ConfigureAwait(false); } [Command("add"), Aliases("create")] @@ -234,7 +234,7 @@ namespace CompatBot.Commands var filter = await db.Piracystring.FirstOrDefaultAsync(ps => ps.Id == id && !ps.Disabled).ConfigureAwait(false); if (filter is null) { - await ctx.RespondAsync("Specified filter does not exist").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Specified filter does not exist").ConfigureAwait(false); return; } @@ -248,7 +248,7 @@ namespace CompatBot.Commands var filter = await db.Piracystring.FirstOrDefaultAsync(ps => ps.String == trigger && !ps.Disabled).ConfigureAwait(false); if (filter is null) { - await ctx.RespondAsync("Specified filter does not exist").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Specified filter does not exist").ConfigureAwait(false); return; } @@ -263,11 +263,11 @@ namespace CompatBot.Commands var filter = await db.Piracystring.FirstOrDefaultAsync(ps => ps.Id == id && !ps.Disabled).ConfigureAwait(false); if (filter is null) { - await ctx.RespondAsync("Specified filter does not exist").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Specified filter does not exist").ConfigureAwait(false); return; } - await ctx.RespondAsync(new DiscordMessageBuilder().WithEmbed(FormatFilter(filter))).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithEmbed(FormatFilter(filter))).ConfigureAwait(false); } [Command("view")] @@ -278,11 +278,11 @@ namespace CompatBot.Commands var filter = await db.Piracystring.FirstOrDefaultAsync(ps => ps.String == trigger && !ps.Disabled).ConfigureAwait(false); if (filter is null) { - await ctx.RespondAsync("Specified filter does not exist").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Specified filter does not exist").ConfigureAwait(false); return; } - await ctx.RespondAsync(new DiscordMessageBuilder().WithEmbed(FormatFilter(filter))).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithEmbed(FormatFilter(filter))).ConfigureAwait(false); } [Command("remove"), Aliases("delete", "del")] @@ -302,7 +302,7 @@ namespace CompatBot.Commands } if (removedFilters < ids.Length) - await ctx.RespondAsync("Some ids couldn't be removed.").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Some ids couldn't be removed.").ConfigureAwait(false); else { await ctx.ReactWithAsync(Config.Reactions.Success, $"Trigger{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false); diff --git a/CompatBot/Commands/EventsBaseCommand.cs b/CompatBot/Commands/EventsBaseCommand.cs index 2af121c7..54e739c8 100644 --- a/CompatBot/Commands/EventsBaseCommand.cs +++ b/CompatBot/Commands/EventsBaseCommand.cs @@ -47,7 +47,7 @@ namespace CompatBot.Commands } if (nextEvent != null) nearestEventMsg += $"Next event: {nextEvent.Name} (starts in {FormatCountdown(nextEvent.Start.AsUtc() - current)})"; - await ctx.RespondAsync(nearestEventMsg.TrimEnd()).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(nearestEventMsg.TrimEnd()).ConfigureAwait(false); return; } @@ -86,7 +86,7 @@ namespace CompatBot.Commands } if (!string.IsNullOrEmpty(promo)) noEventMsg += promo; - await ctx.RespondAsync(noEventMsg).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(noEventMsg).ConfigureAwait(false); return; } @@ -97,7 +97,7 @@ namespace CompatBot.Commands upcomingNamedEventMsg += $"\nFirst event: {firstNamedEvent.Name}"; else upcomingNamedEventMsg += promo; - await ctx.RespondAsync(upcomingNamedEventMsg).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(upcomingNamedEventMsg).ConfigureAwait(false); return; } @@ -119,7 +119,7 @@ namespace CompatBot.Commands } if (!string.IsNullOrEmpty(promo)) noEventMsg += promo; - await ctx.RespondAsync(noEventMsg).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(noEventMsg).ConfigureAwait(false); return; } @@ -128,14 +128,14 @@ namespace CompatBot.Commands upcomingNamedEventMsg += $"\nFirst event: {firstNamedEvent.Name}"; else upcomingNamedEventMsg += promo; - await ctx.RespondAsync(upcomingNamedEventMsg).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(upcomingNamedEventMsg).ConfigureAwait(false); return; } var e3EndedMsg = $"__{eventName} {current.Year} has concluded. See you next year! (maybe)__"; if (!string.IsNullOrEmpty(promo)) e3EndedMsg += promo; - await ctx.RespondAsync(e3EndedMsg).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(e3EndedMsg).ConfigureAwait(false); return; } @@ -175,9 +175,9 @@ namespace CompatBot.Commands db.EventSchedule.RemoveRange(eventsToRemove); var removedCount = await db.SaveChangesAsync().ConfigureAwait(false); if (removedCount == ids.Length) - await ctx.RespondAsync($"Event{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Event{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false); else - await ctx.RespondAsync($"Removed {removedCount} event{StringUtils.GetSuffix(removedCount)}, but was asked to remove {ids.Length}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Removed {removedCount} event{StringUtils.GetSuffix(removedCount)}, but was asked to remove {ids.Length}").ConfigureAwait(false); } protected static async Task Clear(CommandContext ctx, int? year = null) @@ -191,7 +191,7 @@ namespace CompatBot.Commands ).ToListAsync().ConfigureAwait(false); db.EventSchedule.RemoveRange(itemsToRemove); var removedCount = await db.SaveChangesAsync().ConfigureAwait(false); - await ctx.RespondAsync($"Removed {removedCount} event{(removedCount == 1 ? "" : "s")}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Removed {removedCount} event{(removedCount == 1 ? "" : "s")}").ConfigureAwait(false); } protected static async Task Update(CommandContext ctx, int id, string? eventName = null) @@ -243,7 +243,7 @@ namespace CompatBot.Commands .ConfigureAwait(false); if (events.Count == 0) { - await ctx.RespondAsync("There are no events to show").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("There are no events to show").ConfigureAwait(false); return; } diff --git a/CompatBot/Commands/Explain.cs b/CompatBot/Commands/Explain.cs index 490d424e..e265b172 100644 --- a/CompatBot/Commands/Explain.cs +++ b/CompatBot/Commands/Explain.cs @@ -44,7 +44,7 @@ namespace CompatBot.Commands } if (showList) await List(ctx).ConfigureAwait(false); - var botMsg = await ctx.RespondAsync("Please tell what term to explain:").ConfigureAwait(false); + var botMsg = await ctx.Channel.SendMessageAsync("Please tell what term to explain:").ConfigureAwait(false); var interact = ctx.Client.GetInteractivity(); var newMessage = await interact.WaitForMessageAsync(m => m.Author == ctx.User && m.Channel == ctx.Channel && !string.IsNullOrEmpty(m.Content)).ConfigureAwait(false); await botMsg.DeleteAsync().ConfigureAwait(false); @@ -98,7 +98,7 @@ namespace CompatBot.Commands inSpecificLocation = $" in {spamChannel.Mention} or bot DMs"; } var msg = $"Unknown term `{term.Sanitize(replaceBackTicks: true)}`. Use `{ctx.Prefix}explain list` to look at defined terms{inSpecificLocation}"; - await ctx.RespondAsync(msg).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(msg).ConfigureAwait(false); } [Command("add"), RequiresBotModRole] @@ -234,7 +234,7 @@ namespace CompatBot.Commands await using var db = new BotDb(); var keywords = await db.Explanation.Select(e => e.Keyword).OrderBy(t => t).ToListAsync().ConfigureAwait(false); if (keywords.Count == 0) - await ctx.RespondAsync("Nothing has been defined yet").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Nothing has been defined yet").ConfigureAwait(false); else try { diff --git a/CompatBot/Commands/ForcedNicknames.cs b/CompatBot/Commands/ForcedNicknames.cs index e302eeca..f6fa5b05 100644 --- a/CompatBot/Commands/ForcedNicknames.cs +++ b/CompatBot/Commands/ForcedNicknames.cs @@ -52,7 +52,7 @@ namespace CompatBot.Commands { guilds = ctx.Client.Guilds?.Values.ToList() ?? new List(0); if (guilds.Count > 1) - await ctx.RespondAsync($"{discordUser.Mention} will be renamed in all {guilds.Count} servers").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"{discordUser.Mention} will be renamed in all {guilds.Count} servers").ConfigureAwait(false); } else guilds = new(){ctx.Guild}; @@ -175,7 +175,7 @@ namespace CompatBot.Commands var newName = UsernameZalgoMonitor.StripZalgo(name, discordUser.Id); if (name == newName) { - await ctx.RespondAsync("Failed to remove any extra symbols").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Failed to remove any extra symbols").ConfigureAwait(false); } else { @@ -207,7 +207,7 @@ namespace CompatBot.Commands hex = BitConverter.ToString(nameBytes).Replace('-', ' '); result += "\nNickname: " + hex; } - await ctx.RespondAsync(result).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(result).ConfigureAwait(false); } [Command("generate"), Aliases("gen", "suggest")] @@ -215,7 +215,7 @@ namespace CompatBot.Commands public async Task Generate(CommandContext ctx, [Description("Discord user to dump")] DiscordUser discordUser) { var newName = UsernameZalgoMonitor.GenerateRandomName(discordUser.Id); - await ctx.RespondAsync(newName).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(newName).ConfigureAwait(false); } [Command("list"), RequiresBotModRole] @@ -235,7 +235,7 @@ namespace CompatBot.Commands ).ToList(); if (forcedNicknames.Count == 0) { - await ctx.RespondAsync("No users with forced nicknames").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("No users with forced nicknames").ConfigureAwait(false); return; } diff --git a/CompatBot/Commands/Fortune.cs b/CompatBot/Commands/Fortune.cs index f8706e44..5ad73d0d 100644 --- a/CompatBot/Commands/Fortune.cs +++ b/CompatBot/Commands/Fortune.cs @@ -60,7 +60,7 @@ namespace CompatBot.Commands tmp.Append(l).Append('\n'); } msg = tmp.ToString().TrimEnd().FixSpaces(); - await message.RespondAsync($"{user.Mention}, your fortune for today:\n{msg}").ConfigureAwait(false); + await message.Channel.SendMessageAsync($"{user.Mention}, your fortune for today:\n{msg}").ConfigureAwait(false); } [Command("add"), RequiresBotModRole] @@ -101,7 +101,7 @@ namespace CompatBot.Commands [Description("Imports new fortunes from specified URL or attachment. Data should be formatted as standard UNIX fortune source file.")] public async Task Import(CommandContext ctx, string? url = null) { - var msg = await ctx.RespondAsync("Please wait...").ConfigureAwait(false); + var msg = await ctx.Channel.SendMessageAsync("Please wait...").ConfigureAwait(false); if (!await ImportCheck.WaitAsync(0).ConfigureAwait(false)) { await ctx.ReactWithAsync(Config.Reactions.Failure).ConfigureAwait(false); @@ -233,7 +233,7 @@ namespace CompatBot.Commands var builder = new DiscordMessageBuilder() .WithContent($"Exported {count} fortune{(count == 1 ? "": "s")}") .WithFile("fortunes.txt", outputStream); - await ctx.RespondAsync(builder).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(builder).ConfigureAwait(false); } catch (Exception e) { diff --git a/CompatBot/Commands/Invites.cs b/CompatBot/Commands/Invites.cs index 323b7bb9..e30ae793 100644 --- a/CompatBot/Commands/Invites.cs +++ b/CompatBot/Commands/Invites.cs @@ -26,7 +26,7 @@ namespace CompatBot.Commands var whitelistedInvites = await db.WhitelistedInvites.ToListAsync().ConfigureAwait(false); if (whitelistedInvites.Count == 0) { - await ctx.RespondAsync("There are no whitelisted discord servers").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("There are no whitelisted discord servers").ConfigureAwait(false); return; } @@ -163,7 +163,7 @@ namespace CompatBot.Commands if (!await InviteWhitelistProvider.RemoveAsync(id).ConfigureAwait(false)) failedIds.Add(id); if (failedIds.Count > 0) - await ctx.RespondAsync("Some IDs couldn't be removed: " + string.Join(", ", failedIds)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Some IDs couldn't be removed: " + string.Join(", ", failedIds)).ConfigureAwait(false); else await ctx.ReactWithAsync(Config.Reactions.Success, $"Invite{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false); await List(ctx).ConfigureAwait(false); diff --git a/CompatBot/Commands/Ird.cs b/CompatBot/Commands/Ird.cs index 3350263c..139444bf 100644 --- a/CompatBot/Commands/Ird.cs +++ b/CompatBot/Commands/Ird.cs @@ -24,7 +24,7 @@ namespace CompatBot.Commands var result = await Client.SearchAsync(query, Config.Cts.Token).ConfigureAwait(false); var embed = result.AsEmbed(); - await ctx.RespondAsync(embed: embed).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false); } } } diff --git a/CompatBot/Commands/Minesweeper.cs b/CompatBot/Commands/Minesweeper.cs index f0a53b73..5ec91a35 100644 --- a/CompatBot/Commands/Minesweeper.cs +++ b/CompatBot/Commands/Minesweeper.cs @@ -48,7 +48,7 @@ namespace CompatBot.Commands { if (width < 3 || height < 3 || mineCount < 1) { - await ctx.RespondAsync("Invalid generation parameters").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Invalid generation parameters").ConfigureAwait(false); return; } @@ -57,20 +57,20 @@ namespace CompatBot.Commands var maxMineCount = (width - 1) * (height - 1) * 2 / 3; if (mineCount > maxMineCount) { - await ctx.RespondAsync("Isn't this a bit too many mines 🤔").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Isn't this a bit too many mines 🤔").ConfigureAwait(false); return; } if (height > 98) { - await ctx.RespondAsync("Too many lines for one message, Discord would truncate the result randomly").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Too many lines for one message, Discord would truncate the result randomly").ConfigureAwait(false); return; } var msgLen = (4 * width * height - 4) + (height - 1) + mineCount * MaxBombLength + (width * height - mineCount) * "0️⃣".Length + header.Length; if (width * height > 198 || msgLen > 2000) // for some reason discord would cut everything beyond 198 cells even if the content length is well within the limits { - await ctx.RespondAsync("Requested field size is too large for one message").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Requested field size is too large for one message").ConfigureAwait(false); return; } @@ -95,7 +95,7 @@ namespace CompatBot.Commands result.Append('\n'); } result.Append(footer); - await ctx.RespondAsync(result.ToString()).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(result.ToString()).ConfigureAwait(false); } private static byte[,] GenerateField(int width, int height, in int mineCount, in Random rng) diff --git a/CompatBot/Commands/Misc.cs b/CompatBot/Commands/Misc.cs index 713400f0..a52a3e0d 100644 --- a/CompatBot/Commands/Misc.cs +++ b/CompatBot/Commands/Misc.cs @@ -142,7 +142,7 @@ namespace CompatBot.Commands "🙃 TGE\n" + "🍒 Maru\n" + "♋ Tourghool"); - await ctx.RespondAsync(embed: embed.Build()); + await ctx.Channel.SendMessageAsync(embed: embed.Build()); } [Command("roll")] @@ -163,7 +163,7 @@ namespace CompatBot.Commands if (string.IsNullOrEmpty(result)) await message.ReactWithAsync(DiscordEmoji.FromUnicode("💩"), $"How is {maxValue} a positive natural number?").ConfigureAwait(false); else - await message.RespondAsync(result).ConfigureAwait(false); + await message.Channel.SendMessageAsync(result).ConfigureAwait(false); } internal static async Task RollImpl(DiscordMessage message, string dices) @@ -222,9 +222,9 @@ namespace CompatBot.Commands if (string.IsNullOrEmpty(result) && embed == null) await message.ReactWithAsync(DiscordEmoji.FromUnicode("💩"), "Invalid dice description passed").ConfigureAwait(false); else if (embed != null) - await message.RespondAsync(embed).ConfigureAwait(false); + await message.Channel.SendMessageAsync(embed).ConfigureAwait(false); else - await message.RespondAsync(result).ConfigureAwait(false); + await message.Channel.SendMessageAsync(result).ConfigureAwait(false); } [Command("random"), Aliases("rng"), Hidden, Cooldown(1, 3, CooldownBucketType.Channel)] @@ -243,7 +243,7 @@ namespace CompatBot.Commands var count = await db.Thumbnail.CountAsync().ConfigureAwait(false); if (count == 0) { - await ctx.RespondAsync("Sorry, I have no information about a single game yet").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Sorry, I have no information about a single game yet").ConfigureAwait(false); return; } @@ -251,7 +251,7 @@ namespace CompatBot.Commands var productCode = await db.Thumbnail.Skip(tmpRng).Take(1).FirstOrDefaultAsync().ConfigureAwait(false); if (productCode == null) { - await ctx.RespondAsync("Sorry, there's something with my brains today. Try again or something").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Sorry, there's something with my brains today. Try again or something").ConfigureAwait(false); return; } @@ -278,7 +278,7 @@ namespace CompatBot.Commands lock (rng) answer = pool[rng.Next(pool.Count)]; if (answer.StartsWith(':') && answer.EndsWith(':')) answer = ctx.Client.GetEmoji(answer, "🔮"); - await ctx.RespondAsync(answer).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(answer).ConfigureAwait(false); } } @@ -300,7 +300,7 @@ namespace CompatBot.Commands unit = "millennia"; } var willWont = crng.NextDouble() < 0.5 ? "will" : "won't"; - await ctx.RespondAsync($"🔮 My psychic powers tell me it {willWont} happen in the next **{number} {unit}** 🔮").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"🔮 My psychic powers tell me it {willWont} happen in the next **{number} {unit}** 🔮").ConfigureAwait(false); } [Group("how"), Hidden, Cooldown(20, 60, CooldownBucketType.Channel)] @@ -315,10 +315,10 @@ namespace CompatBot.Commands var prefix = DateTime.UtcNow.ToString("yyyyMMddHH"); var crng = new Random((prefix + question).GetHashCode()); if (crng.NextDouble() < 0.0001) - await ctx.RespondAsync($"🔮 My psychic powers tell me the answer should be **3.50** 🔮").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"🔮 My psychic powers tell me the answer should be **3.50** 🔮").ConfigureAwait(false); else { - await ctx.RespondAsync($"🔮 My psychic powers tell me the answer should be **{crng.Next(100) + 1}** 🔮").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"🔮 My psychic powers tell me the answer should be **{crng.Next(100) + 1}** 🔮").ConfigureAwait(false); } } } @@ -480,13 +480,13 @@ namespace CompatBot.Commands .ToList(); if (string.IsNullOrEmpty(whatever)) - await ctx.RespondAsync("Rating nothing makes _**so much**_ sense, right?").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Rating nothing makes _**so much**_ sense, right?").ConfigureAwait(false); else { var seed = (prefix + whatever).GetHashCode(StringComparison.CurrentCultureIgnoreCase); var seededRng = new Random(seed); var answer = choices[seededRng.Next(choices.Count)]; - await ctx.RespondAsync(answer).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(answer).ConfigureAwait(false); } } catch (Exception e) @@ -512,7 +512,7 @@ namespace CompatBot.Commands public Task Compare(CommandContext ctx, string strA, string strB) { var result = strA.GetFuzzyCoefficientCached(strB); - return ctx.RespondAsync($"Similarity score is {result:0.######}"); + return ctx.Channel.SendMessageAsync($"Similarity score is {result:0.######}"); } [Command("productcode"), Aliases("pci", "decode")] @@ -529,10 +529,10 @@ namespace CompatBot.Commands { var embed = await ctx.Client.LookupGameInfoAsync(productCode).ConfigureAwait(false); embed.AddField("Product code info", info); - await ctx.RespondAsync(embed: embed).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false); } else - await ctx.RespondAsync(info).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(info).ConfigureAwait(false); } else await ctx.ReactWithAsync(Config.Reactions.Failure, "Invalid product code").ConfigureAwait(false); @@ -579,7 +579,7 @@ namespace CompatBot.Commands { //drain the enumerable } - await ctx.RespondAsync(embed: embed).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false); } #endif } diff --git a/CompatBot/Commands/Moderation.Audit.cs b/CompatBot/Commands/Moderation.Audit.cs index c29c52ed..a6144a9f 100644 --- a/CompatBot/Commands/Moderation.Audit.cs +++ b/CompatBot/Commands/Moderation.Audit.cs @@ -39,7 +39,7 @@ namespace CompatBot.Commands { if (!await CheckLock.WaitAsync(0).ConfigureAwait(false)) { - await ctx.RespondAsync("Another check is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Another check is already in progress").ConfigureAwait(false); return; } @@ -56,7 +56,7 @@ namespace CompatBot.Commands memoryStream.Seek(0, SeekOrigin.Begin); if (memoryStream.Length <= Config.AttachmentSizeLimit) { - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile("names.txt", memoryStream)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("names.txt", memoryStream)).ConfigureAwait(false); return; } @@ -65,9 +65,9 @@ namespace CompatBot.Commands await gzip.FlushAsync().ConfigureAwait(false); compressedResult.Seek(0, SeekOrigin.Begin); if (compressedResult.Length <= Config.AttachmentSizeLimit) - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile("names.txt.gz", compressedResult)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("names.txt.gz", compressedResult)).ConfigureAwait(false); else - await ctx.RespondAsync($"Dump is too large: {compressedResult.Length} bytes").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Dump is too large: {compressedResult.Length} bytes").ConfigureAwait(false); } catch (Exception e) { @@ -87,7 +87,7 @@ namespace CompatBot.Commands { if (!await CheckLock.WaitAsync(0).ConfigureAwait(false)) { - await ctx.RespondAsync("Another check is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Another check is already in progress").ConfigureAwait(false); return; } @@ -143,7 +143,7 @@ namespace CompatBot.Commands { if (!CheckLock.Wait(0)) { - await ctx.RespondAsync("Another check is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Another check is already in progress").ConfigureAwait(false); return; } @@ -198,7 +198,7 @@ namespace CompatBot.Commands { if (!CheckLock.Wait(0)) { - await ctx.RespondAsync("Another check is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Another check is already in progress").ConfigureAwait(false); return; } @@ -231,13 +231,13 @@ namespace CompatBot.Commands uncompressedStream.Seek(0, SeekOrigin.Begin); if (result.Length <= headerLength) { - await ctx.RespondAsync("No potential name spoofing was detected").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("No potential name spoofing was detected").ConfigureAwait(false); return; } if (uncompressedStream.Length <= Config.AttachmentSizeLimit) { - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile("spoofing_check_results.txt", uncompressedStream)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("spoofing_check_results.txt", uncompressedStream)).ConfigureAwait(false); return; } @@ -248,9 +248,9 @@ namespace CompatBot.Commands } compressedStream.Seek(0, SeekOrigin.Begin); if (compressedStream.Length <= Config.AttachmentSizeLimit) - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile("spoofing_check_results.txt.gz", compressedStream)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("spoofing_check_results.txt.gz", compressedStream)).ConfigureAwait(false); else - await ctx.RespondAsync($"Dump is too large: {compressedStream.Length} bytes").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Dump is too large: {compressedStream.Length} bytes").ConfigureAwait(false); } catch (Exception e) { diff --git a/CompatBot/Commands/Pr.cs b/CompatBot/Commands/Pr.cs index 0c9a16e6..b86ba73b 100644 --- a/CompatBot/Commands/Pr.cs +++ b/CompatBot/Commands/Pr.cs @@ -39,7 +39,7 @@ namespace CompatBot.Commands if (openPrList.Count == 0) { - await ctx.RespondAsync("It looks like there are no open pull requests at the moment 🎉").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("It looks like there are no open pull requests at the moment 🎉").ConfigureAwait(false); return; } @@ -70,7 +70,7 @@ namespace CompatBot.Commands if (openPrList.Count == 0) { - await ctx.RespondAsync("No open pull requests were found for specified filter").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("No open pull requests were found for specified filter").ConfigureAwait(false); return; } @@ -97,7 +97,7 @@ namespace CompatBot.Commands { var azureClient = Config.GetAzureDevOpsClient(); var duration = await azureClient.GetPipelineDurationAsync(Config.Cts.Token).ConfigureAwait(false); - await ctx.RespondAsync( + await ctx.Channel.SendMessageAsync( $"Expected pipeline duration (using {duration.BuildCount} builds): \n" + $"95%: {duration.Percentile95} ({duration.Percentile95.TotalMinutes})\n" + $"90%: {duration.Percentile90} ({duration.Percentile90.TotalMinutes})\n" + @@ -221,7 +221,7 @@ namespace CompatBot.Commands } } } - await message.RespondAsync(embed: embed).ConfigureAwait(false); + await message.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false); } public static async Task LinkIssue(DiscordClient client, DiscordMessage message, int issue) @@ -236,7 +236,7 @@ namespace CompatBot.Commands return; } - await message.RespondAsync(embed: issueInfo.AsEmbed()).ConfigureAwait(false); + await message.Channel.SendMessageAsync(embed: issueInfo.AsEmbed()).ConfigureAwait(false); } } } diff --git a/CompatBot/Commands/Psn.Check.cs b/CompatBot/Commands/Psn.Check.cs index c0d13bee..b2d93993 100644 --- a/CompatBot/Commands/Psn.Check.cs +++ b/CompatBot/Commands/Psn.Check.cs @@ -36,7 +36,7 @@ namespace CompatBot.Commands var id = ProductCodeLookup.GetProductIds(productCode).FirstOrDefault(); if (string.IsNullOrEmpty(id)) { - var botMsg = await ctx.RespondAsync("Please specify a valid product code (e.g. BLUS12345 or NPEB98765):").ConfigureAwait(false); + var botMsg = await ctx.Channel.SendMessageAsync("Please specify a valid product code (e.g. BLUS12345 or NPEB98765):").ConfigureAwait(false); var interact = ctx.Client.GetInteractivity(); var msg = await interact.WaitForMessageAsync(m => m.Author == ctx.User && m.Channel == ctx.Channel && !string.IsNullOrEmpty(m.Content)).ConfigureAwait(false); await botMsg.DeleteAsync().ConfigureAwait(false); @@ -96,7 +96,7 @@ namespace CompatBot.Commands if (embeds.Count > 1 || embeds[0].Fields.Count > 0) embeds[^1] = embeds.Last().WithFooter("Note that you need to install ALL listed updates, one by one"); foreach (var embed in embeds) - await ctx.RespondAsync(embed: embed).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false); } [Command("content"), Hidden] @@ -132,7 +132,7 @@ namespace CompatBot.Commands { var fwList = await Client.GetHighestFwVersionAsync(Config.Cts.Token).ConfigureAwait(false); var embed = fwList.ToEmbed(); - await ctx.RespondAsync(embed: embed).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false); } internal static async Task CheckFwUpdateForAnnouncementAsync(DiscordClient client, List? fwList = null) diff --git a/CompatBot/Commands/Sudo.Bot.Configuration.cs b/CompatBot/Commands/Sudo.Bot.Configuration.cs index 5d1371fc..d0ebe0e9 100644 --- a/CompatBot/Commands/Sudo.Bot.Configuration.cs +++ b/CompatBot/Commands/Sudo.Bot.Configuration.cs @@ -36,10 +36,10 @@ namespace CompatBot.Commands result.AppendLine(v.Key![(SqlConfiguration.ConfigVarPrefix.Length)..]); #endif } - await ctx.RespondAsync(result.ToString()).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(result.ToString()).ConfigureAwait(false); } else - await ctx.RespondAsync("No variables were set yet").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("No variables were set yet").ConfigureAwait(false); } [Command("set")] diff --git a/CompatBot/Commands/Sudo.Bot.cs b/CompatBot/Commands/Sudo.Bot.cs index cbf15032..0bfb74f6 100644 --- a/CompatBot/Commands/Sudo.Bot.cs +++ b/CompatBot/Commands/Sudo.Bot.cs @@ -43,7 +43,7 @@ namespace CompatBot.Commands var stdout = await git.StandardOutput.ReadToEndAsync().ConfigureAwait(false); await git.WaitForExitAsync().ConfigureAwait(false); if (!string.IsNullOrEmpty(stdout)) - await ctx.RespondAsync("```" + stdout + "```").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("```" + stdout + "```").ConfigureAwait(false); } [Command("update"), Aliases("upgrade", "pull", "pet")] @@ -63,7 +63,7 @@ namespace CompatBot.Commands if (!updated) return; - msg = await ctx.RespondAsync("Saving state...").ConfigureAwait(false); + msg = await ctx.Channel.SendMessageAsync("Saving state...").ConfigureAwait(false); await StatsStorage.SaveAsync(true).ConfigureAwait(false); msg = await msg.UpdateOrCreateMessageAsync(ctx.Channel, "Restarting...").ConfigureAwait(false); Restart(ctx.Channel.Id, "Restarted after successful bot update"); @@ -78,7 +78,7 @@ namespace CompatBot.Commands } } else - await ctx.RespondAsync("Update is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Update is already in progress").ConfigureAwait(false); } [Command("restart"), Aliases("reboot")] @@ -90,7 +90,7 @@ namespace CompatBot.Commands DiscordMessage? msg = null; try { - msg = await ctx.RespondAsync("Saving state...").ConfigureAwait(false); + msg = await ctx.Channel.SendMessageAsync("Saving state...").ConfigureAwait(false); await StatsStorage.SaveAsync(true).ConfigureAwait(false); msg = await msg.UpdateOrCreateMessageAsync(ctx.Channel, "Restarting...").ConfigureAwait(false); Restart(ctx.Channel.Id, "Restarted due to command request"); @@ -105,14 +105,14 @@ namespace CompatBot.Commands } } else - await ctx.RespondAsync("Update is in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Update is in progress").ConfigureAwait(false); } [Command("stop"), Aliases("exit", "shutdown", "terminate")] [Description("Stops the bot. Useful if you can't find where you left one running")] public async Task Stop(CommandContext ctx) { - await ctx.RespondAsync(ctx.Channel.IsPrivate + await ctx.Channel.SendMessageAsync(ctx.Channel.IsPrivate ? $"Shutting down bot instance on {Environment.MachineName}..." : "Shutting down the bot..." ).ConfigureAwait(false); @@ -167,14 +167,14 @@ namespace CompatBot.Commands await CompatList.ImportMetacriticScoresAsync().ConfigureAwait(false); await using var db = new ThumbnailDb(); var linkedItems = await db.Thumbnail.CountAsync(i => i.MetacriticId != null).ConfigureAwait(false); - await ctx.RespondAsync($"Importing Metacritic info was successful, linked {linkedItems} items").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Importing Metacritic info was successful, linked {linkedItems} items").ConfigureAwait(false); } finally { ImportLockObj.Release(); } else - await ctx.RespondAsync("Another import operation is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Another import operation is already in progress").ConfigureAwait(false); } internal static async Task<(bool updated, string stdout)> UpdateAsync() diff --git a/CompatBot/Commands/Sudo.Dotnet.cs b/CompatBot/Commands/Sudo.Dotnet.cs index 3f4e1dd0..f6e6c6f3 100644 --- a/CompatBot/Commands/Sudo.Dotnet.cs +++ b/CompatBot/Commands/Sudo.Dotnet.cs @@ -34,7 +34,7 @@ namespace CompatBot.Commands if (!updated) return; - msg = await ctx.RespondAsync("Saving state...").ConfigureAwait(false); + msg = await ctx.Channel.SendMessageAsync("Saving state...").ConfigureAwait(false); await StatsStorage.SaveAsync(true).ConfigureAwait(false); msg = await msg.UpdateOrCreateMessageAsync(ctx.Channel, "Restarting...").ConfigureAwait(false); Bot.Restart(ctx.Channel.Id, "Restarted after successful dotnet update"); @@ -49,7 +49,7 @@ namespace CompatBot.Commands } } else - await ctx.RespondAsync("Update is already in progress").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Update is already in progress").ConfigureAwait(false); } private static async Task<(bool updated, string stdout)> UpdateAsync(string version) diff --git a/CompatBot/Commands/Sudo.Fix.cs b/CompatBot/Commands/Sudo.Fix.cs index d8416527..c565d434 100644 --- a/CompatBot/Commands/Sudo.Fix.cs +++ b/CompatBot/Commands/Sudo.Fix.cs @@ -42,12 +42,12 @@ namespace CompatBot.Commands } } await db.SaveChangesAsync().ConfigureAwait(false); - await ctx.RespondAsync($"Fixed {@fixed} records").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Fixed {@fixed} records").ConfigureAwait(false); } catch (Exception e) { Config.Log.Warn(e, "Couldn't fix warning timestamps"); - await ctx.RespondAsync("Failed to fix warning timestamps").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Failed to fix warning timestamps").ConfigureAwait(false); } } @@ -69,12 +69,12 @@ namespace CompatBot.Commands } } await db.SaveChangesAsync().ConfigureAwait(false); - await ctx.RespondAsync($"Fixed {@fixed} records").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Fixed {@fixed} records").ConfigureAwait(false); } catch (Exception e) { Config.Log.Warn(e, "Couldn't fix channel mentions"); - await ctx.RespondAsync("Failed to fix warning timestamps").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Failed to fix warning timestamps").ConfigureAwait(false); } } @@ -84,19 +84,19 @@ namespace CompatBot.Commands { try { - await ctx.RespondAsync("Fixing invalid function names...").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Fixing invalid function names...").ConfigureAwait(false); var result = await SyscallInfoProvider.FixInvalidFunctionNamesAsync().ConfigureAwait(false); if (result.funcs > 0) - await ctx.RespondAsync($"Successfully fixed {result.funcs} function name{(result.funcs == 1 ? "" : "s")} and {result.links} game link{(result.links == 1 ? "" : "s")}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Successfully fixed {result.funcs} function name{(result.funcs == 1 ? "" : "s")} and {result.links} game link{(result.links == 1 ? "" : "s")}").ConfigureAwait(false); else - await ctx.RespondAsync("No invalid syscall functions detected").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("No invalid syscall functions detected").ConfigureAwait(false); - await ctx.RespondAsync("Fixing duplicates...").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Fixing duplicates...").ConfigureAwait(false); result = await SyscallInfoProvider.FixDuplicatesAsync().ConfigureAwait(false); if (result.funcs > 0) - await ctx.RespondAsync($"Successfully merged {result.funcs} function{(result.funcs == 1 ? "" : "s")} and {result.links} game link{(result.links == 1 ? "" : "s")}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Successfully merged {result.funcs} function{(result.funcs == 1 ? "" : "s")} and {result.links} game link{(result.links == 1 ? "" : "s")}").ConfigureAwait(false); else - await ctx.RespondAsync("No duplicate function entries found").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("No duplicate function entries found").ConfigureAwait(false); } catch (Exception e) { @@ -131,7 +131,7 @@ namespace CompatBot.Commands thumb.Name = newTitle; } await db.SaveChangesAsync(); - await ctx.RespondAsync($"Fixed {changed} title{(changed == 1 ? "" : "s")}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Fixed {changed} title{(changed == 1 ? "" : "s")}").ConfigureAwait(false); } [Command("metacritic_links"), Aliases("mcl")] @@ -151,7 +151,7 @@ namespace CompatBot.Commands changed++; } await db.SaveChangesAsync(); - await ctx.RespondAsync($"Fixed {changed} title{(changed == 1 ? "" : "s")}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Fixed {changed} title{(changed == 1 ? "" : "s")}").ConfigureAwait(false); } public static async Task FixChannelMentionAsync(CommandContext ctx, string? msg) diff --git a/CompatBot/Commands/Sudo.cs b/CompatBot/Commands/Sudo.cs index 706cbaa4..664c3e16 100644 --- a/CompatBot/Commands/Sudo.cs +++ b/CompatBot/Commands/Sudo.cs @@ -150,7 +150,7 @@ namespace CompatBot.Commands if (result.Length <= attachmentSizeLimit) { result.Seek(0, SeekOrigin.Begin); - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile(Path.GetFileName(logPath) + ".gz", result)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile(Path.GetFileName(logPath) + ".gz", result)).ConfigureAwait(false); } else await ctx.ReactWithAsync(Config.Reactions.Failure, "Compressed log size is too large, ask 13xforever for help :(", true).ConfigureAwait(false); @@ -187,7 +187,7 @@ namespace CompatBot.Commands if (result.Length <= attachmentSizeLimit) { result.Seek(0, SeekOrigin.Begin); - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile(Path.GetFileName(dbName) + ".zip", result)).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile(Path.GetFileName(dbName) + ".zip", result)).ConfigureAwait(false); } else await ctx.ReactWithAsync(Config.Reactions.Failure, "Compressed Thumbs.db size is too large, ask 13xforever for help :(", true).ConfigureAwait(false); diff --git a/CompatBot/Commands/Syscall.cs b/CompatBot/Commands/Syscall.cs index 8fd3448a..4ce103fd 100644 --- a/CompatBot/Commands/Syscall.cs +++ b/CompatBot/Commands/Syscall.cs @@ -37,7 +37,7 @@ namespace CompatBot.Commands if (ctx.User.Id == 216724245957312512UL && !search.StartsWith("sys_", StringComparison.InvariantCultureIgnoreCase)) { - await ctx.RespondAsync($"This is not a _syscall_, {ctx.User.Mention}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"This is not a _syscall_, {ctx.User.Mention}").ConfigureAwait(false); return; } @@ -79,11 +79,11 @@ namespace CompatBot.Commands await streamWriter.WriteAsync(fullList).ConfigureAwait(false); await streamWriter.FlushAsync().ConfigureAwait(false); memoryStream.Seek(0, SeekOrigin.Begin); - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile($"{search}.txt", memoryStream).WithContent($"See attached file for full list of {groupedList.Count} entries")).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile($"{search}.txt", memoryStream).WithContent($"See attached file for full list of {groupedList.Count} entries")).ConfigureAwait(false); } } else - await ctx.RespondAsync($"No games found that use `{search}`").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"No games found that use `{search}`").ConfigureAwait(false); } else { @@ -121,14 +121,14 @@ namespace CompatBot.Commands var oldMatches = await db.SyscallInfo.Where(sci => sci.Function == oldFunctionName).ToListAsync().ConfigureAwait(false); if (oldMatches.Count == 0) { - await ctx.RespondAsync($"Function `{oldFunctionName}` could not be found").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Function `{oldFunctionName}` could not be found").ConfigureAwait(false); await Search(ctx, oldFunctionName).ConfigureAwait(false); return; } if (oldMatches.Count > 1) { - await ctx.RespondAsync("More than one matching function was found, I can't handle this right now 😔").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("More than one matching function was found, I can't handle this right now 😔").ConfigureAwait(false); await Search(ctx, oldFunctionName).ConfigureAwait(false); return; } @@ -136,14 +136,14 @@ namespace CompatBot.Commands var conflicts = await db.SyscallInfo.Where(sce => sce.Function == newFunctionName).AnyAsync().ConfigureAwait(false); if (conflicts) { - await ctx.RespondAsync($"There is already a function `{newFunctionName}`").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"There is already a function `{newFunctionName}`").ConfigureAwait(false); await Search(ctx, newFunctionName).ConfigureAwait(false); return; } oldMatches[0].Function = newFunctionName; await db.SaveChangesAsync().ConfigureAwait(false); - await ctx.RespondAsync($"Function `{oldFunctionName}` was successfully renamed to `{newFunctionName}`").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Function `{oldFunctionName}` was successfully renamed to `{newFunctionName}`").ConfigureAwait(false); } private static async Task ReturnSyscallsByGameAsync(CommandContext ctx, string productId) @@ -169,10 +169,10 @@ namespace CompatBot.Commands await streamWriter.WriteAsync(result).ConfigureAwait(false); await streamWriter.FlushAsync().ConfigureAwait(false); memoryStream.Seek(0, SeekOrigin.Begin); - await ctx.RespondAsync(new DiscordMessageBuilder().WithFile($"{productId} syscalls.txt", memoryStream).WithContent($"List of syscalls used by `{title}`")).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile($"{productId} syscalls.txt", memoryStream).WithContent($"List of syscalls used by `{title}`")).ConfigureAwait(false); } else - await ctx.RespondAsync($"No information available for `{title}`").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"No information available for `{title}`").ConfigureAwait(false); } } } \ No newline at end of file diff --git a/CompatBot/Commands/Vision.cs b/CompatBot/Commands/Vision.cs index b146dcdd..b2a76aa6 100644 --- a/CompatBot/Commands/Vision.cs +++ b/CompatBot/Commands/Vision.cs @@ -329,14 +329,14 @@ namespace CompatBot.Commands } else { - await ctx.RespondAsync(description).ConfigureAwait(false); + await ctx.Channel.SendMessageAsync(description).ConfigureAwait(false); await ReactToTagsAsync(ctx.Message, result.Description.Tags).ConfigureAwait(false); } } catch (Exception e) { Config.Log.Error(e, "Failed to tag objects in an image"); - await ctx.RespondAsync("Can't do anything with this image").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync("Can't do anything with this image").ConfigureAwait(false); } } @@ -428,7 +428,7 @@ namespace CompatBot.Commands catch (Exception e) { Config.Log.Warn(e, "Failed to get link to the previously posted image"); - //await ctx.RespondAsync("Sorry chief, can't find any images in the recent posts").ConfigureAwait(false); + //await ctx.Channel.SendMessageAsync("Sorry chief, can't find any images in the recent posts").ConfigureAwait(false); } } return imageUrl; diff --git a/CompatBot/Commands/Warnings.cs b/CompatBot/Commands/Warnings.cs index cc358b81..ab22d68a 100644 --- a/CompatBot/Commands/Warnings.cs +++ b/CompatBot/Commands/Warnings.cs @@ -50,7 +50,7 @@ namespace CompatBot.Commands public async Task Remove(CommandContext ctx, [Description("Warning IDs to remove separated with space")] params int[] ids) { var interact = ctx.Client.GetInteractivity(); - var msg = await ctx.RespondAsync("What is the reason for removal?").ConfigureAwait(false); + var msg = await ctx.Channel.SendMessageAsync("What is the reason for removal?").ConfigureAwait(false); var response = await interact.WaitForMessageAsync( m => m.Author == ctx.User && m.Channel == ctx.Channel @@ -74,9 +74,9 @@ namespace CompatBot.Commands } var removedCount = await db.SaveChangesAsync().ConfigureAwait(false); if (removedCount == ids.Length) - await ctx.RespondAsync($"Warning{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Warning{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false); else - await ctx.RespondAsync($"Removed {removedCount} items, but was asked to remove {ids.Length}").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Removed {removedCount} items, but was asked to remove {ids.Length}").ConfigureAwait(false); } [Command("clear"), RequiresBotModRole] @@ -88,7 +88,7 @@ namespace CompatBot.Commands public async Task Clear(CommandContext ctx, [Description("User ID to clear warnings for")] ulong userId) { var interact = ctx.Client.GetInteractivity(); - var msg = await ctx.RespondAsync("What is the reason for removing all the warnings?").ConfigureAwait(false); + var msg = await ctx.Channel.SendMessageAsync("What is the reason for removing all the warnings?").ConfigureAwait(false); var response = await interact.WaitForMessageAsync(m => m.Author == ctx.User && m.Channel == ctx.Channel && !string.IsNullOrEmpty(m.Content)).ConfigureAwait(false); if (string.IsNullOrEmpty(response.Result?.Content)) { @@ -109,7 +109,7 @@ namespace CompatBot.Commands w.RetractionTimestamp = DateTime.UtcNow.Ticks; } var removed = await db.SaveChangesAsync().ConfigureAwait(false); - await ctx.RespondAsync($"{removed} warning{StringUtils.GetSuffix(removed)} successfully removed!").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"{removed} warning{StringUtils.GetSuffix(removed)} successfully removed!").ConfigureAwait(false); } catch (Exception e) { @@ -229,7 +229,7 @@ namespace CompatBot.Commands (_, _, false, true) => $"{userName} has no warnings, but are they a good boy?", _ => $"{userName} has no warnings", }; - await message.RespondAsync(msg).ConfigureAwait(false); + await message.Channel.SendMessageAsync(msg).ConfigureAwait(false); if (!isPrivate || removed == 0) return; } diff --git a/CompatBot/EventHandlers/UnknownCommandHandler.cs b/CompatBot/EventHandlers/UnknownCommandHandler.cs index 153af415..ce8e03b3 100644 --- a/CompatBot/EventHandlers/UnknownCommandHandler.cs +++ b/CompatBot/EventHandlers/UnknownCommandHandler.cs @@ -97,7 +97,7 @@ namespace CompatBot.EventHandlers #if DEBUG fuzzyNotice = $"Showing explanation for `{fuzzyMatch}` ({score:0.######}):"; #endif - await e.Context.RespondAsync(fuzzyNotice).ConfigureAwait(false); + await e.Context.Channel.SendMessageAsync(fuzzyNotice).ConfigureAwait(false); } StatsStorage.ExplainStatCache.TryGetValue(explanation.Keyword, out int stat); StatsStorage.ExplainStatCache.Set(explanation.Keyword, ++stat, StatsStorage.CacheTime); diff --git a/CompatBot/ThumbScrapper/PsnScraper.cs b/CompatBot/ThumbScrapper/PsnScraper.cs index 305f9b8f..b9d01944 100644 --- a/CompatBot/ThumbScrapper/PsnScraper.cs +++ b/CompatBot/ThumbScrapper/PsnScraper.cs @@ -76,11 +76,11 @@ namespace CompatBot.ThumbScrapper if (relatedContainer == null) continue; - await ctx.RespondAsync($"Found {contentId} in {locale} store").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Found {contentId} in {locale} store").ConfigureAwait(false); await ProcessIncludedGamesAsync(locale, relatedContainer, cancellationToken, false).ConfigureAwait(false); return; } - await ctx.RespondAsync($"Didn't find {contentId} in any PSN store").ConfigureAwait(false); + await ctx.Channel.SendMessageAsync($"Didn't find {contentId} in any PSN store").ConfigureAwait(false); } catch (Exception e) {