Skip to content

Commit

Permalink
Add c!debug dumpdmchannels
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Jul 7, 2024
1 parent 08d12d8 commit 2f66e03
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Commands/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,27 @@ public async Task GetDMChannel(CommandContext ctx, DiscordUser user)
await ctx.RespondAsync(dmChannel.Id.ToString());
}

[Command("dumpdmchannels")]
[Description("Dump all DM channels")]
[IsBotOwner]
public async Task DumpDMChannels(CommandContext ctx)
{
var dmChannels = ctx.Client.PrivateChannels;

var json = JsonConvert.SerializeObject(dmChannels, Formatting.Indented);

HasteBinResult hasteResult = await Program.hasteUploader.Post(json);
if (hasteResult.IsSuccess)
{
await ctx.RespondAsync(hasteResult.FullUrl);
}
else
{
Program.discord.Logger.LogError("Error ocurred uploading to Hastebin with status code: {code}\nPayload: {output}", hasteResult.StatusCode, json);
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Unknown error occurred during upload to Hastebin.\nPlease try again or contact the bot owner.");
}
}

private static async Task<(bool success, ulong failedOverwrite)> ImportOverridesFromChannelAsync(DiscordChannel channel)
{
// Imports overrides from the specified channel to the database. See 'debug overrides import' and 'debug overrides importall'
Expand Down

0 comments on commit 2f66e03

Please sign in to comment.