mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-07-09 23:49:34 +02:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7996a38c5c | |||
| 9d052f9404 | |||
| 3078351670 | |||
| 4f41c4fff3 | |||
| a80ee2943f | |||
| 8612d2c84a | |||
| 57c849d0f8 | |||
| 9c2a26aa82 | |||
| f376028d76 | |||
| da87f3c774 | |||
| 61516feafa | |||
| 8d209cd67a | |||
| c58d7e752b | |||
| fcc1605455 | |||
| f28d662a71 | |||
| a405ab184e | |||
| b861a69799 | |||
| d53b4c825a | |||
| 30678e96e5 |
@@ -1,5 +1,8 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
|
- name: ⚠ Feature request
|
||||||
|
url: https://github.com/Tyrrrz/.github/blob/master/docs/project-status.md
|
||||||
|
about: Sorry, but this project is in maintenance mode and no longer accepts new feature requests.
|
||||||
- name: 💬 Discord server
|
- name: 💬 Discord server
|
||||||
url: https://discord.gg/2SUWKFnHSm
|
url: https://discord.gg/2SUWKFnHSm
|
||||||
about: Chat with the project community.
|
about: Chat with the project community.
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
name: ✨ Feature request
|
|
||||||
description: Request a new feature.
|
|
||||||
labels: [enhancement]
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
🧐 **Guidelines:**
|
|
||||||
|
|
||||||
- Search through [existing issues](https://github.com/Tyrrrz/DiscordChatExporter/issues?q=is%3Aissue) first to ensure that this feature has not been requested before.
|
|
||||||
- Write a descriptive title for your issue. Avoid generic or vague titles such as "Some suggestions" or "Ideas for improvement".
|
|
||||||
- Keep your issue focused on one single problem. If you have multiple feature requests, please create separate issues for each of them.
|
|
||||||
- Provide as much context as possible in the details section. Include screenshots, screen recordings, links, references, or anything else you may consider relevant.
|
|
||||||
- If you want to ask a question instead of requesting a feature, please use [discussions](https://github.com/Tyrrrz/DiscordChatExporter/discussions/new) instead.
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Flavor
|
|
||||||
description: Is this feature request related to specific flavor(s) of DiscordChatExporter? If not applicable, leave this field blank.
|
|
||||||
multiple: true
|
|
||||||
options:
|
|
||||||
- GUI (Graphical User Interface)
|
|
||||||
- CLI (Command Line Interface)
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Export format
|
|
||||||
description: Is this feature request related to specific export format(s)? If not applicable, leave this field blank.
|
|
||||||
multiple: true
|
|
||||||
options:
|
|
||||||
- HTML
|
|
||||||
- TXT
|
|
||||||
- JSON
|
|
||||||
- CSV
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Details
|
|
||||||
description: Clear and thorough explanation of the feature you have in mind.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
.idea/
|
.idea/
|
||||||
.vs/
|
.vs/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
|
|||||||
+14
-3
@@ -1,3 +1,14 @@
|
|||||||
|
### v2.36 (16-Sep-2022)
|
||||||
|
|
||||||
|
- [HTML] Added support for rendering GIFV embeds. They will now render as videos that automatically play when you hover your mouse over them. (Thanks [@gan-of-culture](https://github.com/gan-of-culture))
|
||||||
|
- [HTML] Added support for rendering system notification messages, such as when a user joins a server or when a messages gets pinned. Previously, such messages were rendered as regular text messages, but now they look similar to how they're presented in the Discord client. (Thanks [@gan-of-culture](https://github.com/gan-of-culture))
|
||||||
|
- [CLI] Improved the wording of the error message that's shown when exporting multiple channels and the provided output path is ambiguous. It now mentions that you can resolve the ambiguity by adding a slash at the end of the path.
|
||||||
|
|
||||||
|
### v2.35.2 (08-Sep-2022)
|
||||||
|
|
||||||
|
- Updated usage guide to mention the need to enable "Message Content Intent" to use a bot as a medium for exporting messages.
|
||||||
|
- [CLI] Fixed an issue where passing an existing directory as the output path failed when exporting multiple channels (for example, when running `exportdm`). An ambiguous output path will now always be treated as a directory path if that directory already exists. If it doesn't exist, it will be treated as a file path, matching the previous behavior.
|
||||||
|
|
||||||
### v2.35.1 (26-Aug-2022)
|
### v2.35.1 (26-Aug-2022)
|
||||||
|
|
||||||
- Added `~` character as an alias for `-` when negating a message filter. This should make it easier to use negated filters from CLI where the dash character already has other meanings.
|
- Added `~` character as an alias for `-` when negating a message filter. This should make it easier to use negated filters from CLI where the dash character already has other meanings.
|
||||||
@@ -97,7 +108,7 @@
|
|||||||
|
|
||||||
- [HTML] Added special casing for Spotify track embeds to render them directly using an embedded player.
|
- [HTML] Added special casing for Spotify track embeds to render them directly using an embedded player.
|
||||||
- [HTML] Added special casing for plain image embeds to render them like image attachments.
|
- [HTML] Added special casing for plain image embeds to render them like image attachments.
|
||||||
- [HTML] Added tooltip text for unix timestamp markers which shows the full date represented by the timestamp, regardless of configured date format.
|
- [HTML] Added tooltip text for unix timestamp markers which shows the full date represented by the timestamp, regardless of configured date format.
|
||||||
- [HTML] Updated the fallback text shown when the referenced message could not be loaded to make it more explicit.
|
- [HTML] Updated the fallback text shown when the referenced message could not be loaded to make it more explicit.
|
||||||
- [HTML] Updated styling of quoted text in markdown to more closely resemble how it looks in Discord.
|
- [HTML] Updated styling of quoted text in markdown to more closely resemble how it looks in Discord.
|
||||||
- [HTML] Fixed an issue where some file formats were not correctly recognized as image or video attachments, which affected how they were rendered.
|
- [HTML] Fixed an issue where some file formats were not correctly recognized as image or video attachments, which affected how they were rendered.
|
||||||
@@ -124,7 +135,7 @@
|
|||||||
- [HTML] Added special casing for YouTube video embeds to render them directly using an embedded player. (Thanks [@quentinmay](https://github.com/quentinmay))
|
- [HTML] Added special casing for YouTube video embeds to render them directly using an embedded player. (Thanks [@quentinmay](https://github.com/quentinmay))
|
||||||
- [HTML] Added support for rendering standard emoji by code. Such emoji may sometimes be found in messages sent by bots or through webhooks. (Thanks [@CanePlayz](https://github.com/CanePlayz) and [@Lucas LaBuff](https://github.com/96-LB))
|
- [HTML] Added support for rendering standard emoji by code. Such emoji may sometimes be found in messages sent by bots or through webhooks. (Thanks [@CanePlayz](https://github.com/CanePlayz) and [@Lucas LaBuff](https://github.com/96-LB))
|
||||||
- [HTML] Changed tooltips on standard emoji to show emoji code instead of their raw string representations. (Thanks [@CanePlayz](https://github.com/CanePlayz) and [@Lucas LaBuff](https://github.com/96-LB))
|
- [HTML] Changed tooltips on standard emoji to show emoji code instead of their raw string representations. (Thanks [@CanePlayz](https://github.com/CanePlayz) and [@Lucas LaBuff](https://github.com/96-LB))
|
||||||
- [HTML] Added tooltips on individual messages to show when those messages were sent.
|
- [HTML] Added tooltips on individual messages to show when those messages were sent.
|
||||||
- [HTML] Updated colors and minor styling elements to match Discord's new style direction after rebranding.
|
- [HTML] Updated colors and minor styling elements to match Discord's new style direction after rebranding.
|
||||||
- [HTML] Updated Twemoji URLs to use SVG image variants for better rendering quality.
|
- [HTML] Updated Twemoji URLs to use SVG image variants for better rendering quality.
|
||||||
- [HTML] Changed user avatar URLs to include predetermined size query parameter for better rendering quality.
|
- [HTML] Changed user avatar URLs to include predetermined size query parameter for better rendering quality.
|
||||||
@@ -220,7 +231,7 @@
|
|||||||
- Added a new option that enables self-contained exports for all output formats. You can turn it on in the export setup dialog in GUI or using the `--media` option in CLI. When using this, the application will additionally download any media content directly referenced from the exported file instead of linking back to Discord CDN. The files which are downloaded include: guild icons, user avatars, attachments, embedded images, reaction emoji. Note that only files which are actually referenced by the export are downloaded, which means that, for example, user avatars will not be downloaded when using plain text export format. This option is not meant to enable complete offline viewing for HTML exports, but rather to make it easier to archive media content that may eventually get deleted from Discord servers. Also keep in mind that this option may make the export drastically slower and the total file size larger.
|
- Added a new option that enables self-contained exports for all output formats. You can turn it on in the export setup dialog in GUI or using the `--media` option in CLI. When using this, the application will additionally download any media content directly referenced from the exported file instead of linking back to Discord CDN. The files which are downloaded include: guild icons, user avatars, attachments, embedded images, reaction emoji. Note that only files which are actually referenced by the export are downloaded, which means that, for example, user avatars will not be downloaded when using plain text export format. This option is not meant to enable complete offline viewing for HTML exports, but rather to make it easier to archive media content that may eventually get deleted from Discord servers. Also keep in mind that this option may make the export drastically slower and the total file size larger.
|
||||||
- Changed "discordapp.com" to "discord.com" where applicable as Discord is migrating to a new domain. CDN will remain on "cdn.discordapp.com" for the foreseeable future.
|
- Changed "discordapp.com" to "discord.com" where applicable as Discord is migrating to a new domain. CDN will remain on "cdn.discordapp.com" for the foreseeable future.
|
||||||
|
|
||||||
Note that all existing and current HTML exports will likely not render accurately because Discord enabled CORS for their font resources, which prevents them from loading locally. Please refer to [issue #322](https://github.com/Tyrrrz/DiscordChatExporter/issues/322) for discussion on this topic.
|
Note that all existing and current HTML exports will likely not render accurately because Discord enabled CORS for their font resources, which prevents them from loading locally. Please refer to [issue #322](https://github.com/Tyrrrz/DiscordChatExporter/issues/322) for discussion on this topic.
|
||||||
|
|
||||||
### v2.20 (27-Apr-2020)
|
### v2.20 (27-Apr-2020)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>2.35.1</Version>
|
<Version>2.36</Version>
|
||||||
<Company>Tyrrrz</Company>
|
<Company>Tyrrrz</Company>
|
||||||
<Copyright>Copyright (c) Oleksii Holub</Copyright>
|
<Copyright>Copyright (c) Oleksii Holub</Copyright>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
|
|||||||
@@ -54,8 +54,9 @@ public class EmbedSpecs : IClassFixture<ExportWrapperFixture>
|
|||||||
message
|
message
|
||||||
.QuerySelectorAll("img")
|
.QuerySelectorAll("img")
|
||||||
.Select(e => e.GetAttribute("src"))
|
.Select(e => e.GetAttribute("src"))
|
||||||
|
.Where(s => s?.EndsWith("i.redd.it/f8w05ja8s4e61.png") ?? false)
|
||||||
.Should()
|
.Should()
|
||||||
.Contain("https://i.redd.it/f8w05ja8s4e61.png");
|
.ContainSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -74,6 +75,38 @@ public class EmbedSpecs : IClassFixture<ExportWrapperFixture>
|
|||||||
content.Should().BeNullOrEmpty();
|
content.Should().BeNullOrEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Message_containing_a_gifv_link_is_rendered_with_a_video_embed()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||||
|
ChannelIds.EmbedTestCases,
|
||||||
|
Snowflake.Parse("1019234520349814794")
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
message
|
||||||
|
.QuerySelectorAll("source")
|
||||||
|
.Select(e => e.GetAttribute("src"))
|
||||||
|
.Where(s => s?.EndsWith("media.tenor.com/DDAJeW6BQKkAAAPo/tooncasm-test-copy.mp4") ?? false)
|
||||||
|
.Should()
|
||||||
|
.ContainSingle();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Message_containing_a_gifv_link_and_nothing_else_is_rendered_without_text_content()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||||
|
ChannelIds.EmbedTestCases,
|
||||||
|
Snowflake.Parse("1019234520349814794")
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var content = message.QuerySelector(".chatlog__content")?.Text();
|
||||||
|
content.Should().BeNullOrEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Message_containing_a_Spotify_track_link_is_rendered_with_a_track_embed()
|
public async Task Message_containing_a_Spotify_track_link_is_rendered_with_a_track_embed()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public abstract class ExportCommandBase : TokenCommandBase
|
|||||||
[CommandOption(
|
[CommandOption(
|
||||||
"output",
|
"output",
|
||||||
'o',
|
'o',
|
||||||
Description = "Output file or directory path."
|
Description = "Output file or directory path. Directory path should end in a slash."
|
||||||
)]
|
)]
|
||||||
public string OutputPath
|
public string OutputPath
|
||||||
{
|
{
|
||||||
@@ -97,8 +97,7 @@ public abstract class ExportCommandBase : TokenCommandBase
|
|||||||
|
|
||||||
protected async ValueTask ExecuteAsync(IConsole console, IReadOnlyList<Channel> channels)
|
protected async ValueTask ExecuteAsync(IConsole console, IReadOnlyList<Channel> channels)
|
||||||
{
|
{
|
||||||
var cancellationToken = console.RegisterCancellationHandler();
|
// Reuse media option should only be used when the media option is set.
|
||||||
|
|
||||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/425
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/425
|
||||||
if (ShouldReuseMedia && !ShouldDownloadMedia)
|
if (ShouldReuseMedia && !ShouldDownloadMedia)
|
||||||
{
|
{
|
||||||
@@ -107,14 +106,27 @@ public abstract class ExportCommandBase : TokenCommandBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the user does not try to export all channels into a single file.
|
||||||
|
// Output path must either be a directory, or contain template tokens.
|
||||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/799
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/799
|
||||||
if (channels.Count > 1 && !PathEx.IsDirectoryPath(OutputPath) && !OutputPath.Contains('%'))
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/917
|
||||||
|
var isValidOutputPath =
|
||||||
|
// Anything is valid when exporting a single channel
|
||||||
|
channels.Count <= 1 ||
|
||||||
|
// When using template tokens, assume the user knows what they're doing
|
||||||
|
OutputPath.Contains('%') ||
|
||||||
|
// Otherwise, require an existing directory or an unambiguous directory path
|
||||||
|
Directory.Exists(OutputPath) || PathEx.IsDirectoryPath(OutputPath);
|
||||||
|
|
||||||
|
if (!isValidOutputPath)
|
||||||
{
|
{
|
||||||
throw new CommandException(
|
throw new CommandException(
|
||||||
"Attempted to export multiple channels, but the output path is neither a directory nor a template."
|
"Attempted to export multiple channels, but the output path is neither a directory nor a template. " +
|
||||||
|
"If the provided output path is meant to be treated as a directory, make sure it ends with a slash."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cancellationToken = console.RegisterCancellationHandler();
|
||||||
var errors = new ConcurrentDictionary<Channel, string>();
|
var errors = new ConcurrentDictionary<Channel, string>();
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
|
|||||||
@@ -17,13 +17,14 @@ public class GuideCommand : ICommand
|
|||||||
|
|
||||||
console.Output.WriteLine(" * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!");
|
console.Output.WriteLine(" * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!");
|
||||||
console.Output.WriteLine(" 1. Open Discord in your web browser and login");
|
console.Output.WriteLine(" 1. Open Discord in your web browser and login");
|
||||||
console.Output.WriteLine(" 2. Press Ctrl+Shift+I to show developer tools");
|
console.Output.WriteLine(" 2. Open any server or direct message channel");
|
||||||
console.Output.WriteLine(" 3. Navigate to the Network tab");
|
console.Output.WriteLine(" 3. Press Ctrl+Shift+I to show developer tools");
|
||||||
console.Output.WriteLine(" 4. Press Ctrl+R to reload");
|
console.Output.WriteLine(" 4. Navigate to the Network tab");
|
||||||
console.Output.WriteLine(" 5. Search for a request containing \"messages?limit=50\" or similar");
|
console.Output.WriteLine(" 5. Press Ctrl+R to reload");
|
||||||
console.Output.WriteLine(" 6. Select the Headers tab on the right");
|
console.Output.WriteLine(" 6. Search for a request containing \"messages?limit=50\" or similar");
|
||||||
console.Output.WriteLine(" 7. Scroll down to the Request Headers section");
|
console.Output.WriteLine(" 7. Select the Headers tab on the right");
|
||||||
console.Output.WriteLine(" 8. Copy the value of the \"authorization\" header");
|
console.Output.WriteLine(" 8. Scroll down to the Request Headers section");
|
||||||
|
console.Output.WriteLine(" 9. Copy the value of the \"authorization\" header");
|
||||||
console.Output.WriteLine();
|
console.Output.WriteLine();
|
||||||
|
|
||||||
// Bot token
|
// Bot token
|
||||||
@@ -34,6 +35,7 @@ public class GuideCommand : ICommand
|
|||||||
console.Output.WriteLine(" 2. Open your application's settings");
|
console.Output.WriteLine(" 2. Open your application's settings");
|
||||||
console.Output.WriteLine(" 3. Navigate to the Bot section on the left");
|
console.Output.WriteLine(" 3. Navigate to the Bot section on the left");
|
||||||
console.Output.WriteLine(" 4. Under Token click Copy");
|
console.Output.WriteLine(" 4. Under Token click Copy");
|
||||||
|
console.Output.WriteLine(" * Your bot needs to have Message Content Intent enabled to read messages");
|
||||||
console.Output.WriteLine();
|
console.Output.WriteLine();
|
||||||
|
|
||||||
// Guild or channel ID
|
// Guild or channel ID
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds;
|
|||||||
// https://discord.com/developers/docs/resources/channel#embed-object
|
// https://discord.com/developers/docs/resources/channel#embed-object
|
||||||
public partial record Embed(
|
public partial record Embed(
|
||||||
string? Title,
|
string? Title,
|
||||||
|
EmbedKind Kind,
|
||||||
string? Url,
|
string? Url,
|
||||||
DateTimeOffset? Timestamp,
|
DateTimeOffset? Timestamp,
|
||||||
Color? Color,
|
Color? Color,
|
||||||
@@ -19,11 +20,9 @@ public partial record Embed(
|
|||||||
IReadOnlyList<EmbedField> Fields,
|
IReadOnlyList<EmbedField> Fields,
|
||||||
EmbedImage? Thumbnail,
|
EmbedImage? Thumbnail,
|
||||||
IReadOnlyList<EmbedImage> Images,
|
IReadOnlyList<EmbedImage> Images,
|
||||||
|
EmbedVideo? Video,
|
||||||
EmbedFooter? Footer)
|
EmbedFooter? Footer)
|
||||||
{
|
{
|
||||||
public PlainImageEmbedProjection? TryGetPlainImage() =>
|
|
||||||
PlainImageEmbedProjection.TryResolve(this);
|
|
||||||
|
|
||||||
public SpotifyTrackEmbedProjection? TryGetSpotifyTrack() =>
|
public SpotifyTrackEmbedProjection? TryGetSpotifyTrack() =>
|
||||||
SpotifyTrackEmbedProjection.TryResolve(this);
|
SpotifyTrackEmbedProjection.TryResolve(this);
|
||||||
|
|
||||||
@@ -36,9 +35,20 @@ public partial record Embed
|
|||||||
public static Embed Parse(JsonElement json)
|
public static Embed Parse(JsonElement json)
|
||||||
{
|
{
|
||||||
var title = json.GetPropertyOrNull("title")?.GetStringOrNull();
|
var title = json.GetPropertyOrNull("title")?.GetStringOrNull();
|
||||||
|
|
||||||
|
var kind =
|
||||||
|
json.GetPropertyOrNull("type")?.GetStringOrNull()?.Pipe(s => Enum.Parse<EmbedKind>(s, true)) ??
|
||||||
|
EmbedKind.Rich;
|
||||||
|
|
||||||
var url = json.GetPropertyOrNull("url")?.GetNonWhiteSpaceStringOrNull();
|
var url = json.GetPropertyOrNull("url")?.GetNonWhiteSpaceStringOrNull();
|
||||||
var timestamp = json.GetPropertyOrNull("timestamp")?.GetDateTimeOffset();
|
var timestamp = json.GetPropertyOrNull("timestamp")?.GetDateTimeOffset();
|
||||||
var color = json.GetPropertyOrNull("color")?.GetInt32OrNull()?.Pipe(System.Drawing.Color.FromArgb).ResetAlpha();
|
|
||||||
|
var color = json
|
||||||
|
.GetPropertyOrNull("color")?
|
||||||
|
.GetInt32OrNull()?
|
||||||
|
.Pipe(System.Drawing.Color.FromArgb)
|
||||||
|
.ResetAlpha();
|
||||||
|
|
||||||
var author = json.GetPropertyOrNull("author")?.Pipe(EmbedAuthor.Parse);
|
var author = json.GetPropertyOrNull("author")?.Pipe(EmbedAuthor.Parse);
|
||||||
var description = json.GetPropertyOrNull("description")?.GetStringOrNull();
|
var description = json.GetPropertyOrNull("description")?.GetStringOrNull();
|
||||||
|
|
||||||
@@ -59,10 +69,13 @@ public partial record Embed
|
|||||||
json.GetPropertyOrNull("image")?.Pipe(EmbedImage.Parse).Enumerate().ToArray() ??
|
json.GetPropertyOrNull("image")?.Pipe(EmbedImage.Parse).Enumerate().ToArray() ??
|
||||||
Array.Empty<EmbedImage>();
|
Array.Empty<EmbedImage>();
|
||||||
|
|
||||||
|
var video = json.GetPropertyOrNull("video")?.Pipe(EmbedVideo.Parse);
|
||||||
|
|
||||||
var footer = json.GetPropertyOrNull("footer")?.Pipe(EmbedFooter.Parse);
|
var footer = json.GetPropertyOrNull("footer")?.Pipe(EmbedFooter.Parse);
|
||||||
|
|
||||||
return new Embed(
|
return new Embed(
|
||||||
title,
|
title,
|
||||||
|
kind,
|
||||||
url,
|
url,
|
||||||
timestamp,
|
timestamp,
|
||||||
color,
|
color,
|
||||||
@@ -71,6 +84,7 @@ public partial record Embed
|
|||||||
fields,
|
fields,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
images,
|
images,
|
||||||
|
video,
|
||||||
footer
|
footer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
|
||||||
|
|
||||||
|
// https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||||
|
public enum EmbedKind
|
||||||
|
{
|
||||||
|
Rich,
|
||||||
|
Image,
|
||||||
|
Video,
|
||||||
|
Gifv,
|
||||||
|
Article,
|
||||||
|
Link
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using JsonExtensions.Reading;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
|
||||||
|
|
||||||
|
// https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
|
||||||
|
public record EmbedVideo(
|
||||||
|
string? Url,
|
||||||
|
string? ProxyUrl,
|
||||||
|
int? Width,
|
||||||
|
int? Height)
|
||||||
|
{
|
||||||
|
public static EmbedVideo Parse(JsonElement json)
|
||||||
|
{
|
||||||
|
var url = json.GetPropertyOrNull("url")?.GetNonWhiteSpaceStringOrNull();
|
||||||
|
var proxyUrl = json.GetPropertyOrNull("proxy_url")?.GetNonWhiteSpaceStringOrNull();
|
||||||
|
var width = json.GetPropertyOrNull("width")?.GetInt32OrNull();
|
||||||
|
var height = json.GetPropertyOrNull("height")?.GetInt32OrNull();
|
||||||
|
|
||||||
|
return new EmbedVideo(url, proxyUrl, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using DiscordChatExporter.Core.Utils;
|
|
||||||
|
|
||||||
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
|
|
||||||
|
|
||||||
public record PlainImageEmbedProjection(string Url)
|
|
||||||
{
|
|
||||||
public static PlainImageEmbedProjection? TryResolve(Embed embed)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(embed.Url))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Has to be an embed without any data (except URL and image)
|
|
||||||
if (!string.IsNullOrWhiteSpace(embed.Title) ||
|
|
||||||
embed.Timestamp is not null ||
|
|
||||||
embed.Author is not null ||
|
|
||||||
!string.IsNullOrWhiteSpace(embed.Description) ||
|
|
||||||
embed.Fields.Any() ||
|
|
||||||
embed.Footer is not null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Has to be an image file
|
|
||||||
var fileName = Regex.Match(embed.Url, @".+/([^?]*)").Groups[1].Value;
|
|
||||||
if (string.IsNullOrWhiteSpace(fileName) || !FileFormat.IsImage(Path.GetExtension(fileName)))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new PlainImageEmbedProjection(embed.Url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,6 +21,9 @@ public partial record SpotifyTrackEmbedProjection
|
|||||||
|
|
||||||
public static SpotifyTrackEmbedProjection? TryResolve(Embed embed)
|
public static SpotifyTrackEmbedProjection? TryResolve(Embed embed)
|
||||||
{
|
{
|
||||||
|
if (embed.Kind != EmbedKind.Link)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(embed.Url))
|
if (string.IsNullOrWhiteSpace(embed.Url))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ public partial record YouTubeVideoEmbedProjection
|
|||||||
|
|
||||||
public static YouTubeVideoEmbedProjection? TryResolve(Embed embed)
|
public static YouTubeVideoEmbedProjection? TryResolve(Embed embed)
|
||||||
{
|
{
|
||||||
|
if (embed.Kind != EmbedKind.Video)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(embed.Url))
|
if (string.IsNullOrWhiteSpace(embed.Url))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public record Message(
|
|||||||
{
|
{
|
||||||
var embed = embeds[i];
|
var embed = embeds[i];
|
||||||
|
|
||||||
if (embed.Url?.Contains("://twitter.com/") == true)
|
if (embed.Url?.Contains("://twitter.com/", StringComparison.OrdinalIgnoreCase) == true)
|
||||||
{
|
{
|
||||||
// Find embeds with the same URL that only contain a single image and nothing else
|
// Find embeds with the same URL that only contain a single image and nothing else
|
||||||
var trailingEmbeds = embeds
|
var trailingEmbeds = embeds
|
||||||
@@ -107,6 +107,7 @@ public record Message(
|
|||||||
MessageKind.ChannelNameChange => "Changed the channel name.",
|
MessageKind.ChannelNameChange => "Changed the channel name.",
|
||||||
MessageKind.ChannelIconChange => "Changed the channel icon.",
|
MessageKind.ChannelIconChange => "Changed the channel icon.",
|
||||||
MessageKind.ChannelPinnedMessage => "Pinned a message.",
|
MessageKind.ChannelPinnedMessage => "Pinned a message.",
|
||||||
|
MessageKind.ThreadCreated => "Started a thread.",
|
||||||
MessageKind.GuildMemberJoin => "Joined the server.",
|
MessageKind.GuildMemberJoin => "Joined the server.",
|
||||||
_ => json.GetPropertyOrNull("content")?.GetStringOrNull() ?? ""
|
_ => json.GetPropertyOrNull("content")?.GetStringOrNull() ?? ""
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,5 +11,12 @@ public enum MessageKind
|
|||||||
ChannelIconChange = 5,
|
ChannelIconChange = 5,
|
||||||
ChannelPinnedMessage = 6,
|
ChannelPinnedMessage = 6,
|
||||||
GuildMemberJoin = 7,
|
GuildMemberJoin = 7,
|
||||||
|
ThreadCreated = 18,
|
||||||
Reply = 19
|
Reply = 19
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MessageKindExtensions
|
||||||
|
{
|
||||||
|
public static bool IsSystemNotification(this MessageKind c) =>
|
||||||
|
c is not MessageKind.Default and not MessageKind.Reply;
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Gress" Version="2.0.1" />
|
<PackageReference Include="Gress" Version="2.0.1" />
|
||||||
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
||||||
<PackageReference Include="MiniRazor.CodeGen" Version="2.2.1" />
|
<PackageReference Include="MiniRazor.CodeGen" Version="2.2.2" />
|
||||||
<PackageReference Include="Polly" Version="7.2.3" />
|
<PackageReference Include="Polly" Version="7.2.3" />
|
||||||
<PackageReference Include="Superpower" Version="3.0.0" />
|
<PackageReference Include="Superpower" Version="3.0.0" />
|
||||||
<PackageReference Include="WebMarkupMin.Core" Version="2.12.0" />
|
<PackageReference Include="WebMarkupMin.Core" Version="2.12.0" />
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using DiscordChatExporter.Core.Discord.Data;
|
||||||
|
using DiscordChatExporter.Core.Discord.Data.Embeds;
|
||||||
|
|
||||||
|
namespace DiscordChatExporter.Core.Exporting.Writers.Html;
|
||||||
|
|
||||||
|
internal static class MessageExtensions
|
||||||
|
{
|
||||||
|
// Message content is hidden if it's a link to an embedded media
|
||||||
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/682
|
||||||
|
public static bool IsContentHidden(this Message message)
|
||||||
|
{
|
||||||
|
if (message.Embeds.Count != 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var embed = message.Embeds[0];
|
||||||
|
|
||||||
|
return
|
||||||
|
string.Equals(message.Content.Trim(), embed.Url, StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
embed.Kind is EmbedKind.Image or EmbedKind.Gifv;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,438 +48,476 @@
|
|||||||
{
|
{
|
||||||
var isFirst = i == 0;
|
var isFirst = i == 0;
|
||||||
|
|
||||||
// Hide message content if it only contains a link to an image which is embedded, and nothing else
|
|
||||||
var isContentHidden =
|
|
||||||
message.Embeds.Count == 1 &&
|
|
||||||
message.Content.Trim() == PlainImageEmbedProjection.TryResolve(message.Embeds.Single())?.Url;
|
|
||||||
|
|
||||||
var isReferencedContentHidden =
|
|
||||||
message.ReferencedMessage is not null &&
|
|
||||||
message.ReferencedMessage.Embeds.Count == 1 &&
|
|
||||||
message.ReferencedMessage.Content.Trim() == PlainImageEmbedProjection.TryResolve(message.ReferencedMessage.Embeds.Single())?.Url;
|
|
||||||
|
|
||||||
<div id="chatlog__message-container-@message.Id" class="chatlog__message-container @(message.IsPinned ? "chatlog__message-container--pinned" : null)" data-message-id="@message.Id">
|
<div id="chatlog__message-container-@message.Id" class="chatlog__message-container @(message.IsPinned ? "chatlog__message-container--pinned" : null)" data-message-id="@message.Id">
|
||||||
<div class="chatlog__message">
|
<div class="chatlog__message">
|
||||||
@{/* Left side */}
|
@{/* System notification */}
|
||||||
<div class="chatlog__message-aside">
|
@if (message.Kind.IsSystemNotification())
|
||||||
@if (isFirst)
|
{
|
||||||
{
|
// System notifications are grouped even if the message author is different.
|
||||||
// Reference symbol
|
// That's why we have to update the user values with the author of the current message.
|
||||||
if (message.Reference is not null)
|
userMember = Model.ExportContext.TryGetMember(message.Author.Id);
|
||||||
{
|
userColor = Model.ExportContext.TryGetUserColor(message.Author.Id);
|
||||||
<div class="chatlog__reference-symbol"></div>
|
userNick = message.Author.IsBot
|
||||||
}
|
? message.Author.Name
|
||||||
|
: userMember?.Nick ?? message.Author.Name;
|
||||||
|
|
||||||
// Avatar
|
<div class="chatlog__message-aside">
|
||||||
<img class="chatlog__avatar" src="@await ResolveUrlAsync(message.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
<svg class=chatlog__system-notification-icon><use href="#@message.Kind.ToString().ToDashCase().ToLowerInvariant()-icon"></use></svg>
|
||||||
}
|
</div>
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="chatlog__short-timestamp" title="@FormatDate(message.Timestamp)">@message.Timestamp.ToLocalString("t")</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@{/* Right side */}
|
<div class="chatlog__message-primary">
|
||||||
<div class="chatlog__message-primary">
|
|
||||||
@if (isFirst)
|
|
||||||
{
|
|
||||||
// Reference
|
|
||||||
if (message.Reference is not null)
|
|
||||||
{
|
|
||||||
<div class="chatlog__reference">
|
|
||||||
@if (message.ReferencedMessage is not null)
|
|
||||||
{
|
|
||||||
<img class="chatlog__reference-avatar" src="@await ResolveUrlAsync(message.ReferencedMessage.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
|
||||||
<div class="chatlog__reference-author" style="@(referencedUserColor is not null ? $"color: rgb({referencedUserColor.Value.R}, {referencedUserColor.Value.G}, {referencedUserColor.Value.B})" : null)" title="@message.ReferencedMessage.Author.FullName">@referencedUserNick</div>
|
|
||||||
<div class="chatlog__reference-content">
|
|
||||||
<span class="chatlog__reference-link" onclick="scrollToMessage(event, '@message.ReferencedMessage.Id')">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(message.ReferencedMessage.Content) && !isReferencedContentHidden)
|
|
||||||
{
|
|
||||||
<!--wmm:ignore-->@Raw(FormatEmbedMarkdown(message.ReferencedMessage.Content))<!--/wmm:ignore-->
|
|
||||||
}
|
|
||||||
else if (message.ReferencedMessage.Attachments.Any() || message.ReferencedMessage.Embeds.Any())
|
|
||||||
{
|
|
||||||
<em>Click to see attachment</em>
|
|
||||||
<span>🖼️</span>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<em>Click to see original message</em>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
@if (message.ReferencedMessage.EditedTimestamp is not null)
|
|
||||||
{
|
|
||||||
<span class="chatlog__reference-edited-timestamp" title="@FormatDate(message.ReferencedMessage.EditedTimestamp.Value)">(edited)</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="chatlog__reference-unknown">
|
|
||||||
Original message was deleted or could not be loaded.
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
// Header
|
|
||||||
<div class="chatlog__header">
|
<div class="chatlog__header">
|
||||||
@{/* Author name */}
|
@{/* Author name */}
|
||||||
<span class="chatlog__author" style="@(userColor is not null ? $"color: rgb({userColor.Value.R}, {userColor.Value.G}, {userColor.Value.B})" : null)" title="@message.Author.FullName" data-user-id="@message.Author.Id">@userNick</span>
|
<span class="chatlog__author" style="@(userColor is not null ? $"color: rgb({userColor.Value.R}, {userColor.Value.G}, {userColor.Value.B})" : null)" title="@message.Author.FullName" data-user-id="@message.Author.Id">@userNick</span>
|
||||||
|
|
||||||
@{/* Bot label */}
|
@{/* System notification content */}
|
||||||
@if (message.Author.IsBot)
|
@if(message.Kind == MessageKind.ChannelPinnedMessage)
|
||||||
{
|
{
|
||||||
<span class="chatlog__bot-label">BOT</span>
|
<span class="chatlog__system-notification"> pinned</span>
|
||||||
|
<span class="chatlog__system-notification-reference-link chatlog__reference-link" onclick="scrollToMessage(event, '@message.Reference?.MessageId')"> a message</span>
|
||||||
|
<span class="chatlog__system-notification"> to this channel.</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="chatlog__system-notification">@(char.ToLowerInvariant(message.Content[0]) + message.Content[1..])</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
@{/* Timestamp */}
|
@{/* Timestamp */}
|
||||||
<span class="chatlog__timestamp"><a href="#chatlog__message-container-@message.Id">@FormatDate(message.Timestamp)</a></span>
|
<span class="chatlog__timestamp"><a href="#chatlog__message-container-@message.Id">@FormatDate(message.Timestamp)</a></span>
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
|
}
|
||||||
@{/* Content */}
|
// Regular message
|
||||||
@if (!string.IsNullOrWhiteSpace(message.Content) || message.EditedTimestamp is not null)
|
else
|
||||||
{
|
{
|
||||||
<div class="chatlog__content chatlog__markdown">
|
<div class="chatlog__message-aside">
|
||||||
@{/* Text */}
|
@if (isFirst)
|
||||||
@if (!isContentHidden)
|
{
|
||||||
|
// Reference symbol
|
||||||
|
if (message.Reference is not null)
|
||||||
{
|
{
|
||||||
<span class="chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatMarkdown(message.Content))<!--/wmm:ignore--></span>
|
<div class="chatlog__reference-symbol"></div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@{/* Edited timestamp */}
|
// Avatar
|
||||||
@if (message.EditedTimestamp is not null)
|
<img class="chatlog__avatar" src="@await ResolveUrlAsync(message.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
||||||
{
|
}
|
||||||
<span class="chatlog__edited-timestamp" title="@FormatDate(message.EditedTimestamp.Value)">(edited)</span>
|
else
|
||||||
}
|
{
|
||||||
</div>
|
<div class="chatlog__short-timestamp" title="@FormatDate(message.Timestamp)">@message.Timestamp.ToLocalString("t")</div>
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
@{/* Attachments */}
|
<div class="chatlog__message-primary">
|
||||||
@foreach (var attachment in message.Attachments)
|
@if (isFirst)
|
||||||
{
|
{
|
||||||
<div class="chatlog__attachment @(attachment.IsSpoiler ? "chatlog__attachment--hidden" : null)" onclick="@(attachment.IsSpoiler ? "showSpoiler(event, this)" : null)">
|
// Reference
|
||||||
@{/* Spoiler caption */}
|
if (message.Reference is not null)
|
||||||
@if (attachment.IsSpoiler)
|
|
||||||
{
|
{
|
||||||
<div class="chatlog__attachment-spoiler-caption">SPOILER</div>
|
<div class="chatlog__reference">
|
||||||
}
|
@if (message.ReferencedMessage is not null)
|
||||||
|
{
|
||||||
|
<img class="chatlog__reference-avatar" src="@await ResolveUrlAsync(message.ReferencedMessage.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
||||||
|
<div class="chatlog__reference-author" style="@(referencedUserColor is not null ? $"color: rgb({referencedUserColor.Value.R}, {referencedUserColor.Value.G}, {referencedUserColor.Value.B})" : null)" title="@message.ReferencedMessage.Author.FullName">@referencedUserNick</div>
|
||||||
|
<div class="chatlog__reference-content">
|
||||||
|
<span class="chatlog__reference-link" onclick="scrollToMessage(event, '@message.ReferencedMessage.Id')">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(message.ReferencedMessage.Content) && !message.ReferencedMessage.IsContentHidden())
|
||||||
|
{
|
||||||
|
<!--wmm:ignore-->@Raw(FormatEmbedMarkdown(message.ReferencedMessage.Content))<!--/wmm:ignore-->
|
||||||
|
}
|
||||||
|
else if (message.ReferencedMessage.Attachments.Any() || message.ReferencedMessage.Embeds.Any())
|
||||||
|
{
|
||||||
|
<em>Click to see attachment</em>
|
||||||
|
<span>🖼️</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<em>Click to see original message</em>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
|
||||||
@{/* Attachment preview */}
|
@if (message.ReferencedMessage.EditedTimestamp is not null)
|
||||||
@if (attachment.IsImage)
|
{
|
||||||
{
|
<span class="chatlog__reference-edited-timestamp" title="@FormatDate(message.ReferencedMessage.EditedTimestamp.Value)">(edited)</span>
|
||||||
<a href="@await ResolveUrlAsync(attachment.Url)">
|
}
|
||||||
<img class="chatlog__attachment-media" src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Image attachment")" title="Image: @attachment.FileName (@attachment.FileSize)" loading="lazy">
|
</div>
|
||||||
</a>
|
}
|
||||||
}
|
else
|
||||||
else if (attachment.IsVideo)
|
{
|
||||||
{
|
<div class="chatlog__reference-unknown">
|
||||||
<video class="chatlog__attachment-media" controls>
|
Original message was deleted or could not be loaded.
|
||||||
<source src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Video attachment")" title="Video: @attachment.FileName (@attachment.FileSize)">
|
</div>
|
||||||
</video>
|
}
|
||||||
}
|
|
||||||
else if (attachment.IsAudio)
|
|
||||||
{
|
|
||||||
<audio class="chatlog__attachment-media" controls>
|
|
||||||
<source src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Audio attachment")" title="Audio: @attachment.FileName (@attachment.FileSize)">
|
|
||||||
</audio>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="chatlog__attachment-generic">
|
|
||||||
<svg class="chatlog__attachment-generic-icon">
|
|
||||||
<use href="#attachment-icon"/>
|
|
||||||
</svg>
|
|
||||||
<div class="chatlog__attachment-generic-name">
|
|
||||||
<a href="@await ResolveUrlAsync(attachment.Url)">
|
|
||||||
@attachment.FileName
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="chatlog__attachment-generic-size">
|
|
||||||
@attachment.FileSize
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Embeds */}
|
// Header
|
||||||
@foreach (var embed in message.Embeds)
|
<div class="chatlog__header">
|
||||||
{
|
@{/* Author name */}
|
||||||
// Plain image embed
|
<span class="chatlog__author" style="@(userColor is not null ? $"color: rgb({userColor.Value.R}, {userColor.Value.G}, {userColor.Value.B})" : null)" title="@message.Author.FullName" data-user-id="@message.Author.Id">@userNick</span>
|
||||||
if (embed.TryGetPlainImage() is { } plainImageEmbed)
|
|
||||||
{
|
@{/* Bot label */}
|
||||||
<div class="chatlog__embed">
|
@if (message.Author.IsBot)
|
||||||
<a href="@await ResolveUrlAsync(plainImageEmbed.Url)">
|
|
||||||
<img class="chatlog__embed-plainimage" src="@await ResolveUrlAsync(plainImageEmbed.Url)" alt="Embedded image" loading="lazy">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
// Spotify embed
|
|
||||||
else if (embed.TryGetSpotifyTrack() is { } spotifyTrackEmbed)
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed">
|
|
||||||
<div class="chatlog__embed-spotify-container">
|
|
||||||
<iframe class="chatlog__embed-spotify" src="@spotifyTrackEmbed.Url" width="400" height="80" allowtransparency="true" allow="encrypted-media"></iframe>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
// YouTube embed
|
|
||||||
else if (embed.TryGetYouTubeVideo() is { } youTubeVideoEmbed)
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed">
|
|
||||||
@{/* Color pill */}
|
|
||||||
@if (embed.Color is not null)
|
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-color-pill" style="background-color: rgba(@embed.Color.Value.R, @embed.Color.Value.G, @embed.Color.Value.B, @embed.Color.Value.A)"></div>
|
<span class="chatlog__bot-label">BOT</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Timestamp */}
|
||||||
|
<span class="chatlog__timestamp"><a href="#chatlog__message-container-@message.Id">@FormatDate(message.Timestamp)</a></span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Content */}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(message.Content) || message.EditedTimestamp is not null)
|
||||||
|
{
|
||||||
|
<div class="chatlog__content chatlog__markdown">
|
||||||
|
@{/* Text */}
|
||||||
|
@if (!message.IsContentHidden())
|
||||||
|
{
|
||||||
|
<span class="chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatMarkdown(message.Content))<!--/wmm:ignore--></span>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Edited timestamp */}
|
||||||
|
@if (message.EditedTimestamp is not null)
|
||||||
|
{
|
||||||
|
<span class="chatlog__edited-timestamp" title="@FormatDate(message.EditedTimestamp.Value)">(edited)</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Attachments */}
|
||||||
|
@foreach (var attachment in message.Attachments)
|
||||||
|
{
|
||||||
|
<div class="chatlog__attachment @(attachment.IsSpoiler ? "chatlog__attachment--hidden" : null)" onclick="@(attachment.IsSpoiler ? "showSpoiler(event, this)" : null)">
|
||||||
|
@{/* Spoiler caption */}
|
||||||
|
@if (attachment.IsSpoiler)
|
||||||
|
{
|
||||||
|
<div class="chatlog__attachment-spoiler-caption">SPOILER</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Attachment preview */}
|
||||||
|
@if (attachment.IsImage)
|
||||||
|
{
|
||||||
|
<a href="@await ResolveUrlAsync(attachment.Url)">
|
||||||
|
<img class="chatlog__attachment-media" src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Image attachment")" title="Image: @attachment.FileName (@attachment.FileSize)" loading="lazy">
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
else if (attachment.IsVideo)
|
||||||
|
{
|
||||||
|
<video class="chatlog__attachment-media" controls>
|
||||||
|
<source src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Video attachment")" title="Video: @attachment.FileName (@attachment.FileSize)">
|
||||||
|
</video>
|
||||||
|
}
|
||||||
|
else if (attachment.IsAudio)
|
||||||
|
{
|
||||||
|
<audio class="chatlog__attachment-media" controls>
|
||||||
|
<source src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Audio attachment")" title="Audio: @attachment.FileName (@attachment.FileSize)">
|
||||||
|
</audio>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-color-pill chatlog__embed-color-pill--default"></div>
|
<div class="chatlog__attachment-generic">
|
||||||
|
<svg class="chatlog__attachment-generic-icon">
|
||||||
|
<use href="#attachment-icon"/>
|
||||||
|
</svg>
|
||||||
|
<div class="chatlog__attachment-generic-name">
|
||||||
|
<a href="@await ResolveUrlAsync(attachment.Url)">
|
||||||
|
@attachment.FileName
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="chatlog__attachment-generic-size">
|
||||||
|
@attachment.FileSize
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="chatlog__embed-content-container">
|
@{/* Embeds */}
|
||||||
<div class="chatlog__embed-content">
|
@foreach (var embed in message.Embeds)
|
||||||
<div class="chatlog__embed-text">
|
{
|
||||||
@{/* Embed author */}
|
// Spotify embed
|
||||||
@if (embed.Author is not null)
|
if (embed.TryGetSpotifyTrack() is { } spotifyTrackEmbed)
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-author-container">
|
<div class="chatlog__embed">
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
<div class="chatlog__embed-spotify-container">
|
||||||
{
|
<iframe class="chatlog__embed-spotify" src="@spotifyTrackEmbed.Url" width="400" height="80" allowtransparency="true" allow="encrypted-media"></iframe>
|
||||||
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
</div>
|
||||||
}
|
</div>
|
||||||
|
}
|
||||||
|
// YouTube embed
|
||||||
|
else if (embed.TryGetYouTubeVideo() is { } youTubeVideoEmbed)
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed">
|
||||||
|
@{/* Color pill */}
|
||||||
|
@if (embed.Color is not null)
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-color-pill" style="background-color: rgba(@embed.Color.Value.R, @embed.Color.Value.G, @embed.Color.Value.B, @embed.Color.Value.A)"></div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-color-pill chatlog__embed-color-pill--default"></div>
|
||||||
|
}
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
<div class="chatlog__embed-content-container">
|
||||||
{
|
<div class="chatlog__embed-content">
|
||||||
if (!string.IsNullOrWhiteSpace(embed.Author.Url))
|
<div class="chatlog__embed-text">
|
||||||
|
@{/* Embed author */}
|
||||||
|
@if (embed.Author is not null)
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-author-container">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
||||||
{
|
{
|
||||||
<a class="chatlog__embed-author-link" href="@embed.Author.Url">
|
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(embed.Author.Url))
|
||||||
|
{
|
||||||
|
<a class="chatlog__embed-author-link" href="@embed.Author.Url">
|
||||||
|
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Embed title */}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Title))
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-title">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Url))
|
||||||
|
{
|
||||||
|
<a class="chatlog__embed-title-link" href="@embed.Url">
|
||||||
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Embed title */}
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Title))
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-title">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Url))
|
|
||||||
{
|
|
||||||
<a class="chatlog__embed-title-link" href="@embed.Url">
|
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
||||||
</a>
|
}
|
||||||
}
|
</div>
|
||||||
else
|
}
|
||||||
{
|
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Video player */}
|
@{/* Video player */}
|
||||||
<div class="chatlog__embed-youtube-container">
|
<div class="chatlog__embed-youtube-container">
|
||||||
<iframe class="chatlog__embed-youtube" src="@youTubeVideoEmbed.Url" width="400" height="225"></iframe>
|
<iframe class="chatlog__embed-youtube" src="@youTubeVideoEmbed.Url" width="400" height="225"></iframe>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
// Generic image embed
|
||||||
// Generic embed
|
else if (embed.Kind == EmbedKind.Image && !string.IsNullOrWhiteSpace(embed.Url))
|
||||||
else
|
{
|
||||||
{
|
<div class="chatlog__embed">
|
||||||
<div class="chatlog__embed">
|
<a href="@await ResolveUrlAsync(embed.Url)">
|
||||||
@{/* Color pill */}
|
<img class="chatlog__embed-generic-image" src="@await ResolveUrlAsync(embed.Url)" alt="Embedded image" loading="lazy">
|
||||||
@if (embed.Color is not null)
|
</a>
|
||||||
{
|
</div>
|
||||||
<div class="chatlog__embed-color-pill" style="background-color: rgba(@embed.Color.Value.R, @embed.Color.Value.G, @embed.Color.Value.B, @embed.Color.Value.A)"></div>
|
}
|
||||||
}
|
// Generic gifv embed
|
||||||
else
|
else if (embed.Kind == EmbedKind.Gifv && !string.IsNullOrWhiteSpace(embed.Video?.Url))
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-color-pill chatlog__embed-color-pill--default"></div>
|
<div class="chatlog__embed">
|
||||||
}
|
<video class="chatlog__embed-generic-gifv" loop width="@embed.Video.Width" height="@embed.Video.Height" onmouseover="this.play()" onmouseout="this.pause()">
|
||||||
|
<source src="@await ResolveUrlAsync(embed.Video.ProxyUrl ?? embed.Video.Url)" alt="Embedded video">
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
// Rich embed
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed">
|
||||||
|
@{/* Color pill */}
|
||||||
|
@if (embed.Color is not null)
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-color-pill" style="background-color: rgba(@embed.Color.Value.R, @embed.Color.Value.G, @embed.Color.Value.B, @embed.Color.Value.A)"></div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-color-pill chatlog__embed-color-pill--default"></div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="chatlog__embed-content-container">
|
<div class="chatlog__embed-content-container">
|
||||||
<div class="chatlog__embed-content">
|
<div class="chatlog__embed-content">
|
||||||
<div class="chatlog__embed-text">
|
<div class="chatlog__embed-text">
|
||||||
@{/* Embed author */}
|
@{/* Embed author */}
|
||||||
@if (embed.Author is not null)
|
@if (embed.Author is not null)
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-author-container">
|
<div class="chatlog__embed-author-container">
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
||||||
{
|
|
||||||
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(embed.Author.Url))
|
|
||||||
{
|
{
|
||||||
<a class="chatlog__embed-author-link" href="@embed.Author.Url">
|
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(embed.Author.Url))
|
||||||
|
{
|
||||||
|
<a class="chatlog__embed-author-link" href="@embed.Author.Url">
|
||||||
|
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Embed title */}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Title))
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-title">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Url))
|
||||||
|
{
|
||||||
|
<a class="chatlog__embed-title-link" href="@embed.Url">
|
||||||
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-author">@embed.Author.Name</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Embed title */}
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Title))
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-title">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Url))
|
|
||||||
{
|
|
||||||
<a class="chatlog__embed-title-link" href="@embed.Url">
|
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
||||||
</a>
|
}
|
||||||
}
|
</div>
|
||||||
else
|
}
|
||||||
{
|
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Title))<!--/wmm:ignore--></div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Embed description */}
|
@{/* Embed description */}
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Description))
|
@if (!string.IsNullOrWhiteSpace(embed.Description))
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-description">
|
||||||
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Description))<!--/wmm:ignore--></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Embed fields */}
|
||||||
|
@if (embed.Fields.Any())
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-fields">
|
||||||
|
@foreach (var field in embed.Fields)
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-field @(field.IsInline ? "chatlog__embed-field--inline" : null)">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(field.Name))
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-field-name">
|
||||||
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(field.Name))<!--/wmm:ignore--></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(field.Value))
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-field-value">
|
||||||
|
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(field.Value))<!--/wmm:ignore--></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@{/* Embed content */}
|
||||||
|
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-description">
|
<div class="chatlog__embed-thumbnail-container">
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(embed.Description))<!--/wmm:ignore--></div>
|
<a class="chatlog__embed-thumbnail-link" href="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
|
||||||
</div>
|
<img class="chatlog__embed-thumbnail" src="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy">
|
||||||
}
|
</a>
|
||||||
|
|
||||||
@{/* Embed fields */}
|
|
||||||
@if (embed.Fields.Any())
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-fields">
|
|
||||||
@foreach (var field in embed.Fields)
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-field @(field.IsInline ? "chatlog__embed-field--inline" : null)">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(field.Name))
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-field-name">
|
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(field.Name))<!--/wmm:ignore--></div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(field.Value))
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-field-value">
|
|
||||||
<div class="chatlog__markdown chatlog__markdown-preserve"><!--wmm:ignore-->@Raw(FormatEmbedMarkdown(field.Value))<!--/wmm:ignore--></div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@{/* Embed content */}
|
@{/* Embed images */}
|
||||||
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
|
@if (embed.Images.Any())
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-thumbnail-container">
|
<div class="chatlog__embed-images @(embed.Images.Count == 1 ? "chatlog__embed-images--single" : null)">
|
||||||
<a class="chatlog__embed-thumbnail-link" href="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
|
@foreach (var image in embed.Images)
|
||||||
<img class="chatlog__embed-thumbnail" src="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy">
|
{
|
||||||
</a>
|
if (!string.IsNullOrWhiteSpace(image.Url))
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-image-container">
|
||||||
|
<a class="chatlog__embed-image-link" href="@await ResolveUrlAsync(image.ProxyUrl ?? image.Url)">
|
||||||
|
<img class="chatlog__embed-image" src="@await ResolveUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Embed footer & icon */}
|
||||||
|
@if (embed.Footer is not null || embed.Timestamp is not null)
|
||||||
|
{
|
||||||
|
<div class="chatlog__embed-footer">
|
||||||
|
@{/* Footer icon */}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
||||||
|
{
|
||||||
|
<img class="chatlog__embed-footer-icon" src="@await ResolveUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy">
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="chatlog__embed-footer-text">
|
||||||
|
@{/* Footer text */}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Footer?.Text))
|
||||||
|
{
|
||||||
|
@embed.Footer.Text
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(embed.Footer?.Text) && embed.Timestamp is not null)
|
||||||
|
{
|
||||||
|
@(" • ")
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Embed timestamp */}
|
||||||
|
@if (embed.Timestamp is not null)
|
||||||
|
{
|
||||||
|
@FormatDate(embed.Timestamp.Value)
|
||||||
|
}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@{/* Embed images */}
|
|
||||||
@if (embed.Images.Any())
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-images @(embed.Images.Count == 1 ? "chatlog__embed-images--single" : null)">
|
|
||||||
@foreach (var image in embed.Images)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(image.Url))
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-image-container">
|
|
||||||
<a class="chatlog__embed-image-link" href="@await ResolveUrlAsync(image.ProxyUrl ?? image.Url)">
|
|
||||||
<img class="chatlog__embed-image" src="@await ResolveUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Embed footer & icon */}
|
|
||||||
@if (embed.Footer is not null || embed.Timestamp is not null)
|
|
||||||
{
|
|
||||||
<div class="chatlog__embed-footer">
|
|
||||||
@{/* Footer icon */}
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
|
||||||
{
|
|
||||||
<img class="chatlog__embed-footer-icon" src="@await ResolveUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy">
|
|
||||||
}
|
|
||||||
|
|
||||||
<span class="chatlog__embed-footer-text">
|
|
||||||
@{/* Footer text */}
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Footer?.Text))
|
|
||||||
{
|
|
||||||
@embed.Footer.Text
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Footer?.Text) && embed.Timestamp is not null)
|
|
||||||
{
|
|
||||||
@(" • ")
|
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Embed timestamp */}
|
|
||||||
@if (embed.Timestamp is not null)
|
|
||||||
{
|
|
||||||
@FormatDate(embed.Timestamp.Value)
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@{/* Stickers */}
|
||||||
|
@foreach (var sticker in message.Stickers)
|
||||||
|
{
|
||||||
|
<div class="chatlog__sticker" title="@sticker.Name">
|
||||||
|
@if (sticker.Format is StickerFormat.Png or StickerFormat.PngAnimated)
|
||||||
|
{
|
||||||
|
<img class="chatlog__sticker--media" src="@await ResolveUrlAsync(sticker.SourceUrl)" alt="Sticker">
|
||||||
|
}
|
||||||
|
else if (sticker.Format == StickerFormat.Lottie)
|
||||||
|
{
|
||||||
|
<div class="chatlog__sticker--media" data-source="@await ResolveUrlAsync(sticker.SourceUrl)"></div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@{/* Stickers */}
|
@{/* Message reactions */}
|
||||||
@foreach (var sticker in message.Stickers)
|
@if (message.Reactions.Any())
|
||||||
{
|
{
|
||||||
<div class="chatlog__sticker" title="@sticker.Name">
|
<div class="chatlog__reactions">
|
||||||
@if (sticker.Format is StickerFormat.Png or StickerFormat.PngAnimated)
|
@foreach (var reaction in message.Reactions)
|
||||||
{
|
{
|
||||||
<img class="chatlog__sticker--media" src="@await ResolveUrlAsync(sticker.SourceUrl)" alt="Sticker">
|
<div class="chatlog__reaction" title="@reaction.Emoji.Code">
|
||||||
}
|
<img class="chatlog__emoji chatlog__emoji--small" alt="@reaction.Emoji.Name" src="@await ResolveUrlAsync(reaction.Emoji.ImageUrl)" loading="lazy">
|
||||||
else if (sticker.Format == StickerFormat.Lottie)
|
<span class="chatlog__reaction-count">@reaction.Count</span>
|
||||||
{
|
</div>
|
||||||
<div class="chatlog__sticker--media" data-source="@await ResolveUrlAsync(sticker.SourceUrl)"></div>
|
}
|
||||||
}
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
</div>
|
||||||
|
}
|
||||||
@{/* Message reactions */}
|
|
||||||
@if (message.Reactions.Any())
|
|
||||||
{
|
|
||||||
<div class="chatlog__reactions">
|
|
||||||
@foreach (var reaction in message.Reactions)
|
|
||||||
{
|
|
||||||
<div class="chatlog__reaction" title="@reaction.Emoji.Code">
|
|
||||||
<img class="chatlog__emoji chatlog__emoji--small" alt="@reaction.Emoji.Name" src="@await ResolveUrlAsync(reaction.Emoji.ImageUrl)" loading="lazy">
|
|
||||||
<span class="chatlog__reaction-count">@reaction.Count</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,20 @@
|
|||||||
unicode-bidi: bidi-override;
|
unicode-bidi: bidi-override;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chatlog__system-notification {
|
||||||
|
color: @Themed("#96989d", "#5e6772")
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__system-notification-reference-link {
|
||||||
|
font-weight: 500;
|
||||||
|
color: @Themed("#ffffff", "#2f3136");
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__system-notification-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
.chatlog__header {
|
.chatlog__header {
|
||||||
margin-bottom: 0.1rem;
|
margin-bottom: 0.1rem;
|
||||||
}
|
}
|
||||||
@@ -540,7 +554,14 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatlog__embed-plainimage {
|
.chatlog__embed-generic-image {
|
||||||
|
max-width: 45vw;
|
||||||
|
max-height: 500px;
|
||||||
|
vertical-align: top;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__embed-generic-gifv {
|
||||||
max-width: 45vw;
|
max-width: 45vw;
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
@@ -779,13 +800,24 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
@{/* Icons */}
|
@{/* Icons */}
|
||||||
<svg style="display: none">
|
<svg style="display: none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<symbol id="attachment-icon" viewBox="0 0 720 960">
|
<defs>
|
||||||
<path fill="#f4f5fb" d="M50,935a25,25,0,0,1-25-25V50A25,25,0,0,1,50,25H519.6L695,201.32V910a25,25,0,0,1-25,25Z"/>
|
<symbol id="attachment-icon" viewBox="0 0 720 960">
|
||||||
<path fill="#7789c4" d="M509.21,50,670,211.63V910H50V50H509.21M530,0H50A50,50,0,0,0,0,50V910a50,50,0,0,0,50,50H670a50,50,0,0,0,50-50h0V191Z"/>
|
<path fill="#f4f5fb" d="M50,935a25,25,0,0,1-25-25V50A25,25,0,0,1,50,25H519.6L695,201.32V910a25,25,0,0,1-25,25Z" />
|
||||||
<path fill="#f4f5fb" d="M530,215a25,25,0,0,1-25-25V50a25,25,0,0,1,16.23-23.41L693.41,198.77A25,25,0,0,1,670,215Z"/>
|
<path fill="#7789c4" d="M509.21,50,670,211.63V910H50V50H509.21M530,0H50A50,50,0,0,0,0,50V910a50,50,0,0,0,50,50H670a50,50,0,0,0,50-50h0V191Z" />
|
||||||
<path fill="#7789c4" d="M530,70.71,649.29,190H530V70.71M530,0a50,50,0,0,0-50,50V190a50,50,0,0,0,50,50H670a50,50,0,0,0,50-50Z"/>
|
<path fill="#f4f5fb" d="M530,215a25,25,0,0,1-25-25V50a25,25,0,0,1,16.23-23.41L693.41,198.77A25,25,0,0,1,670,215Z" />
|
||||||
</symbol>
|
<path fill="#7789c4" d="M530,70.71,649.29,190H530V70.71M530,0a50,50,0,0,0-50,50V190a50,50,0,0,0,50,50H670a50,50,0,0,0,50-50Z" />
|
||||||
|
</symbol>
|
||||||
|
<symbol id="channel-pinned-message-icon" viewBox="0 0 18 18">
|
||||||
|
<path fill="#b9bbbe" d="m16.908 8.39684-8.29587-8.295827-1.18584 1.184157 1.18584 1.18584-4.14834 4.1475v.00167l-1.18583-1.18583-1.185 1.18583 3.55583 3.55502-4.740831 4.74 1.185001 1.185 4.74083-4.74 3.55581 3.555 1.185-1.185-1.185-1.185 4.1475-4.14836h.0009l1.185 1.185z" />
|
||||||
|
</symbol>
|
||||||
|
<symbol id="call-icon" viewBox="0 0 18 18">
|
||||||
|
<path fill="#3ba55c" fill-rule="evenodd" d="M17.7163041 15.36645368c-.0190957.02699568-1.9039523 2.6680735-2.9957762 2.63320406-3.0676659-.09785935-6.6733809-3.07188394-9.15694343-5.548738C3.08002193 9.9740657.09772497 6.3791404 0 3.3061316v-.024746C0 2.2060575 2.61386252.3152347 2.64082114.2972376c.7110335-.4971705 1.4917101-.3149497 1.80959713.1372281.19320342.2744561 2.19712724 3.2811005 2.42290565 3.6489167.09884826.1608492.14714912.3554431.14714912.5702838 0 .2744561-.07975258.5770327-.23701117.8751101-.1527655.2902036-.65262318 1.1664385-.89862055 1.594995.2673396.3768148.94804468 1.26429792 2.351016 2.66357424 1.39173858 1.39027775 2.28923588 2.07641807 2.67002628 2.34187563.4302146-.2452108 1.3086162-.74238132 1.5972981-.89423205.5447887-.28682915 1.0907006-.31944893 1.4568885-.08661115.3459689.2182151 3.3383754 2.21027167 3.6225641 2.41611376.2695862.19234426.4144887.5399137.4144887.91672846 0 .2969525-.089862.61190215-.2808189.88523346" />
|
||||||
|
</symbol>
|
||||||
|
<symbol id="guild-member-join-icon" viewBox="0 0 18 18">
|
||||||
|
<path fill="#3ba55c" d="m0 8h14.2l-3.6-3.6 1.4-1.4 6 6-6 6-1.4-1.4 3.6-3.6h-14.2" />
|
||||||
|
</symbol>
|
||||||
|
</defs>
|
||||||
</svg>
|
</svg>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -25,17 +25,46 @@ internal class HtmlMessageWriter : MessageWriter
|
|||||||
_themeName = themeName;
|
_themeName = themeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanJoinGroup(Message message) =>
|
private bool CanJoinGroup(Message message)
|
||||||
// First message in the group can always join
|
{
|
||||||
_messageGroup.LastOrDefault() is not { } lastMessage ||
|
// If the group is empty, any message can join it
|
||||||
// Must be from the same author
|
if (_messageGroup.LastOrDefault() is not { } lastMessage)
|
||||||
lastMessage.Author.Id == message.Author.Id &&
|
return true;
|
||||||
// Author's name must not have changed between messages
|
|
||||||
string.Equals(lastMessage.Author.FullName, message.Author.FullName, StringComparison.Ordinal) &&
|
// Reply messages cannot join existing groups because they need to appear first
|
||||||
// Duration between messages must be 7 minutes or less
|
if (message.Kind == MessageKind.Reply)
|
||||||
(message.Timestamp - lastMessage.Timestamp).Duration().TotalMinutes <= 7 &&
|
return false;
|
||||||
// Other message must not be a reply
|
|
||||||
message.Reference is null;
|
// Grouping for system notifications
|
||||||
|
if (message.Kind.IsSystemNotification())
|
||||||
|
{
|
||||||
|
// Can only be grouped with other system notifications
|
||||||
|
if (!lastMessage.Kind.IsSystemNotification())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Grouping for normal messages
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Can only be grouped with other normal messages
|
||||||
|
if (lastMessage.Kind.IsSystemNotification())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Messages must be within 7 minutes of each other
|
||||||
|
if ((message.Timestamp - lastMessage.Timestamp).Duration().TotalMinutes > 7)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Messages must be from the same author
|
||||||
|
if (message.Author.Id != lastMessage.Author.Id)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If the user changed their name after the last message, their new messages
|
||||||
|
// cannot join an existing group.
|
||||||
|
if (!string.Equals(message.Author.FullName, lastMessage.Author.FullName, StringComparison.Ordinal))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Use <!--wmm:ignore--> to preserve blocks of code inside the templates
|
// Use <!--wmm:ignore--> to preserve blocks of code inside the templates
|
||||||
private string Minify(string html) => _minifier
|
private string Minify(string html) => _minifier
|
||||||
@@ -77,7 +106,7 @@ internal class HtmlMessageWriter : MessageWriter
|
|||||||
await base.WriteMessageAsync(message, cancellationToken);
|
await base.WriteMessageAsync(message, cancellationToken);
|
||||||
|
|
||||||
// If the message can be grouped, buffer it for now
|
// If the message can be grouped, buffer it for now
|
||||||
if (CanJoinGroup( message))
|
if (CanJoinGroup(message))
|
||||||
{
|
{
|
||||||
_messageGroup.Add(message);
|
_messageGroup.Add(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace DiscordChatExporter.Core.Utils.Extensions;
|
namespace DiscordChatExporter.Core.Utils.Extensions;
|
||||||
|
|
||||||
@@ -25,6 +26,9 @@ public static class StringExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToDashCase(this string str) =>
|
||||||
|
Regex.Replace(str, @"(\p{Ll})(\p{Lu})", "$1-$2");
|
||||||
|
|
||||||
public static StringBuilder AppendIfNotEmpty(this StringBuilder builder, char value) =>
|
public static StringBuilder AppendIfNotEmpty(this StringBuilder builder, char value) =>
|
||||||
builder.Length > 0
|
builder.Length > 0
|
||||||
? builder.Append(value)
|
? builder.Append(value)
|
||||||
|
|||||||
@@ -135,22 +135,14 @@
|
|||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Background="{DynamicResource MaterialDesignCardBackground}"
|
Background="{DynamicResource MaterialDesignCardBackground}"
|
||||||
IsEnabled="{Binding IsBusy, Converter={x:Static converters:InverseBoolConverter.Instance}}">
|
IsEnabled="{Binding IsBusy, Converter={x:Static converters:InverseBoolConverter.Instance}}">
|
||||||
<Grid.Resources>
|
|
||||||
<Style TargetType="TextBlock">
|
|
||||||
<Setter Property="FontWeight" Value="Light" />
|
|
||||||
</Style>
|
|
||||||
</Grid.Resources>
|
|
||||||
<!-- Placeholder / usage instructions -->
|
<!-- Placeholder / usage instructions -->
|
||||||
<Grid Visibility="{Binding AvailableGuilds, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}">
|
<Grid Visibility="{Binding AvailableGuilds, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}">
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="32,16"
|
Margin="32,16"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
|
FontWeight="Light"
|
||||||
LineHeight="20">
|
LineHeight="20">
|
||||||
<Run FontSize="18" Text="Please provide authentication token to continue" />
|
|
||||||
<LineBreak />
|
|
||||||
<LineBreak />
|
|
||||||
|
|
||||||
<!-- User token -->
|
<!-- User token -->
|
||||||
<InlineUIContainer>
|
<InlineUIContainer>
|
||||||
<materialDesign:PackIcon
|
<materialDesign:PackIcon
|
||||||
@@ -158,7 +150,7 @@
|
|||||||
Foreground="{DynamicResource PrimaryHueMidBrush}"
|
Foreground="{DynamicResource PrimaryHueMidBrush}"
|
||||||
Kind="Account" />
|
Kind="Account" />
|
||||||
</InlineUIContainer>
|
</InlineUIContainer>
|
||||||
<Run FontSize="16" Text="To get token for your personal account:" />
|
<Run FontSize="16" FontWeight="SemiBold" Text="To get token for your personal account:" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="* Automating user accounts is technically against TOS —" />
|
<Run Text="* Automating user accounts is technically against TOS —" />
|
||||||
<Run FontWeight="SemiBold" Text="use at your own risk" /><Run Text="!" />
|
<Run FontWeight="SemiBold" Text="use at your own risk" /><Run Text="!" />
|
||||||
@@ -169,31 +161,33 @@
|
|||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
<Run Text="and login" />
|
<Run Text="and login" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="2. Press" />
|
<Run Text="2. Open any server or direct message channel" />
|
||||||
|
<LineBreak />
|
||||||
|
<Run Text="3. Press" />
|
||||||
<Run FontWeight="SemiBold" Text="Ctrl+Shift+I" />
|
<Run FontWeight="SemiBold" Text="Ctrl+Shift+I" />
|
||||||
<Run Text="to show developer tools" />
|
<Run Text="to show developer tools" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="3. Navigate to the" />
|
<Run Text="4. Navigate to the" />
|
||||||
<Run FontWeight="SemiBold" Text="Network" />
|
<Run FontWeight="SemiBold" Text="Network" />
|
||||||
<Run Text="tab" />
|
<Run Text="tab" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="4. Press" />
|
<Run Text="5. Press" />
|
||||||
<Run FontWeight="SemiBold" Text="Ctrl+R" />
|
<Run FontWeight="SemiBold" Text="Ctrl+R" />
|
||||||
<Run Text="to reload" />
|
<Run Text="to reload" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="5. Search for a request containing" />
|
<Run Text="6. Search for a request containing" />
|
||||||
<Run FontWeight="SemiBold" Text="messages?limit=50" />
|
<Run FontWeight="SemiBold" Text="messages?limit=50" />
|
||||||
<Run Text="or similar" />
|
<Run Text="or similar" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="6. Select the" />
|
<Run Text="7. Select the" />
|
||||||
<Run FontWeight="SemiBold" Text="Headers" />
|
<Run FontWeight="SemiBold" Text="Headers" />
|
||||||
<Run Text=" tab on the right" />
|
<Run Text=" tab on the right" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="7. Scroll down to the" />
|
<Run Text="8. Scroll down to the" />
|
||||||
<Run FontWeight="SemiBold" Text="Request Headers" />
|
<Run FontWeight="SemiBold" Text="Request Headers" />
|
||||||
<Run Text="section" />
|
<Run Text="section" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="8. Copy the value of the" />
|
<Run Text="9. Copy the value of the" />
|
||||||
<Run FontWeight="SemiBold" Text="authorization" />
|
<Run FontWeight="SemiBold" Text="authorization" />
|
||||||
<Run Text="header" />
|
<Run Text="header" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
@@ -206,7 +200,7 @@
|
|||||||
Foreground="{DynamicResource PrimaryHueMidBrush}"
|
Foreground="{DynamicResource PrimaryHueMidBrush}"
|
||||||
Kind="Robot" />
|
Kind="Robot" />
|
||||||
</InlineUIContainer>
|
</InlineUIContainer>
|
||||||
<Run FontSize="16" Text="To get token for a bot account:" />
|
<Run FontSize="16" FontWeight="SemiBold" Text="To get token for a bot account:" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="1. Open Discord" />
|
<Run Text="1. Open Discord" />
|
||||||
<Hyperlink Command="{s:Action OpenDiscordDeveloperPortal}">
|
<Hyperlink Command="{s:Action OpenDiscordDeveloperPortal}">
|
||||||
@@ -224,10 +218,14 @@
|
|||||||
<Run Text="click" />
|
<Run Text="click" />
|
||||||
<Run FontWeight="SemiBold" Text="Copy" />
|
<Run FontWeight="SemiBold" Text="Copy" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
|
<Run Text="* Your bot needs to have" />
|
||||||
|
<Run FontWeight="SemiBold" Text="Message Content Intent" />
|
||||||
|
<Run Text="enabled to read messages" />
|
||||||
|
<LineBreak />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
|
|
||||||
<Run FontSize="16" Text="If you have questions or issues, please refer to the" />
|
<Run Text="If you have questions or issues, please refer to the" />
|
||||||
<Hyperlink Command="{s:Action ShowHelp}" FontSize="16">wiki</Hyperlink><Run FontSize="16" Text="." />
|
<Hyperlink Command="{s:Action ShowHelp}">wiki</Hyperlink><Run Text="." />
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
[](https://tyrrrz.me/donate)
|
[](https://tyrrrz.me/donate)
|
||||||
[](https://twitter.com/tyrrrz/status/1495972128977571848)
|
[](https://twitter.com/tyrrrz/status/1495972128977571848)
|
||||||
|
|
||||||
> 🟢 **Project status**: active<sup>[[?]](https://github.com/Tyrrrz/.github/blob/master/docs/project-status.md)</sup>
|
> 🟡 **Project status**: maintenance mode<sup>[[?]](https://github.com/Tyrrrz/.github/blob/master/docs/project-status.md)</sup>
|
||||||
|
|
||||||
**DiscordChatExporter** can be used to export message history from a [Discord](https://discord.com) channel to a file.
|
**DiscordChatExporter** can be used to export message history from a [Discord](https://discord.com) channel to a file.
|
||||||
It works with direct messages, group messages, and server channels, and supports Discord's dialect of markdown as well as all other rich media features.
|
It works with direct messages, group messages, and server channels, and supports Discord's dialect of markdown as well as all other rich media features.
|
||||||
@@ -65,6 +65,7 @@ The following table lists all available download options:
|
|||||||
<li>🟠 <a href="https://github.com/Tyrrrz/DiscordChatExporter/actions/workflows/main.yml">CI build</a> (<code>DiscordChatExporter.CLI.zip</code>)</li>
|
<li>🟠 <a href="https://github.com/Tyrrrz/DiscordChatExporter/actions/workflows/main.yml">CI build</a> (<code>DiscordChatExporter.CLI.zip</code>)</li>
|
||||||
<li>🐋 <a href="https://hub.docker.com/r/tyrrrz/discordchatexporter">Docker</a> (<code>tyrrrz/discordchatexporter</code>)</li>
|
<li>🐋 <a href="https://hub.docker.com/r/tyrrrz/discordchatexporter">Docker</a> (<code>tyrrrz/discordchatexporter</code>)</li>
|
||||||
<li>📦 <a href="https://aur.archlinux.org/packages/discord-chat-exporter-cli">AUR</a> (<code>discord-chat-exporter-cli</code>)</li>
|
<li>📦 <a href="https://aur.archlinux.org/packages/discord-chat-exporter-cli">AUR</a> (<code>discord-chat-exporter-cli</code>)</li>
|
||||||
|
<li>📦 <a href="https://search.nixos.org/packages?query=discordchatexporter-cli">Nix</a> (<code>discordchatexporter-cli</code>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -79,15 +80,19 @@ The following table lists all available download options:
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
> **Note**:
|
> **Note**:
|
||||||
> **DiscordChatExporter**'s AUR package is maintained by the community.
|
> AUR and Nix packages linked above are maintained by the community.
|
||||||
|
> If you have any issues with them, please contact the corresponding maintainers.
|
||||||
|
|
||||||
> **Warning**:
|
> **Warning**:
|
||||||
> To run **DiscordChatExporter** on macOS or Linux, you will need to additionally install **.NET Runtime v6**:
|
> To run **DiscordChatExporter** on macOS and Linux, you need to make sure that **.NET Runtime v6** is installed.
|
||||||
|
> You can download it here:
|
||||||
|
>
|
||||||
> - [.NET Runtime v6 for **macOS x64**](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.6-macos-x64-installer)
|
> - [.NET Runtime v6 for **macOS x64**](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.6-macos-x64-installer)
|
||||||
> - [.NET Runtime v6 for **macOS Arm64**](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.6-macos-arm64-installer)
|
> - [.NET Runtime v6 for **macOS Arm64**](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.6-macos-arm64-installer)
|
||||||
> - [.NET Runtime v6 for **Linux**](https://docs.microsoft.com/en-us/dotnet/core/install/linux) (find the correct download for your distro)
|
> - [.NET Runtime v6 for **Linux**](https://docs.microsoft.com/en-us/dotnet/core/install/linux) (find the correct download for your distro)
|
||||||
>
|
>
|
||||||
> This is not required if you installed **DiscordChatExporter** using a package manager, or if you plan to run **DiscordChatExporter** via Docker.
|
> This should not be necessary if you install **DiscordChatExporter** using a package manager, as it should take care of the dependencies for you.
|
||||||
|
> This is also not necessary if you are running **DiscordChatExporter** via Docker, because the image already contains the runtime.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -102,4 +107,4 @@ The following table lists all available download options:
|
|||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|||||||
Reference in New Issue
Block a user