Benjamin-Loison / DiscordChatExporter

Exports Discord chat logs to a file
MIT License
0 stars 0 forks source link

How to run on Linux only with open-source software? #1

Closed Benjamin-Loison closed 2 weeks ago

Benjamin-Loison commented 10 months ago

Am I even able to run it on Windows with closed-source software? Yes:

DiscordChatExporter.Cli.exe
Output: ``` Your system is missing runtime components required by DiscordChatExporter.Cli: - .NET Runtime (Base) v8.0.0 Would you like to download and install them now? [y/n] DiscordChatExporter.Cli: installing prerequisites [1/2] Downloading .NET Runtime (Base) v8.0.0... Done [2/2] Installing .NET Runtime (Base) v8.0.0... Done Prerequisites installed successfully. DiscordChatExporter.Cli v2.42.6 USAGE DiscordChatExporter.Cli [options] DiscordChatExporter.Cli [command] [...] OPTIONS -h|--help Shows help text. --version Shows version information. COMMANDS channels Get the list of channels in a guild. dm Gets the list of all direct message channels. export Exports one or multiple channels. exportall Exports all accessible channels. exportdm Exports all direct message channels. exportguild Exports all channels within the specified guild. guide Explains how to obtain the token, guild or channel ID. guilds Gets the list of accessible guilds. You can run `DiscordChatExporter.Cli [command] --help` to show help on a specific command. ```

What about Linux with closed-source software on a virtual machine?

On simple sudo apt install -y mono-runtime, I get (identical output with ./DiscordChatExporter.Cli.exe):

mono DiscordChatExporter.Cli.exe
Output: ``` ERROR: System.TypeInitializationException: The type initializer for 'DotnetRuntimeBootstrapper.AppHost.Core.Platform.OperatingSystemEx' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DotnetRuntimeBootstrapper.AppHost.Core.Native.SystemVersionInfo' threw an exception. ---> System.DllNotFoundException: ntdll.dll assembly: type: member:(null) at (wrapper managed-to-native) DotnetRuntimeBootstrapper.AppHost.Core.Native.NativeMethods.RtlGetVersion(DotnetRuntimeBootstrapper.AppHost.Core.Native.SystemVersionInfo&) at DotnetRuntimeBootstrapper.AppHost.Core.Native.SystemVersionInfo.Resolve () [0x00008] in <5ede2dcc081445dfbf451e0716d43386>:0 at DotnetRuntimeBootstrapper.AppHost.Core.Native.SystemVersionInfo..cctor () [0x00000] in <5ede2dcc081445dfbf451e0716d43386>:0 --- End of inner exception stack trace --- at DotnetRuntimeBootstrapper.AppHost.Core.Platform.OperatingSystemEx..cctor () [0x00000] in <5ede2dcc081445dfbf451e0716d43386>:0 --- End of inner exception stack trace --- at DotnetRuntimeBootstrapper.AppHost.Core.Prerequisites.WindowsUpdate2999226Prerequisite.IsInstalled () [0x00000] in <5ede2dcc081445dfbf451e0716d43386>:0 at DotnetRuntimeBootstrapper.AppHost.Core.TargetAssembly+<>c.b__8_0 (DotnetRuntimeBootstrapper.AppHost.Core.Prerequisites.IPrerequisite p) [0x00000] in <5ede2dcc081445dfbf451e0716d43386>:0 at System.Collections.Generic.List`1[T].RemoveAll (System.Predicate`1[T] match) [0x00023] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 at DotnetRuntimeBootstrapper.AppHost.Core.TargetAssembly.GetMissingPrerequisites () [0x0004c] in <5ede2dcc081445dfbf451e0716d43386>:0 at DotnetRuntimeBootstrapper.AppHost.Core.BootstrapperBase.Run (DotnetRuntimeBootstrapper.AppHost.Core.TargetAssembly targetAssembly, System.String[] args) [0x0000b] in <5ede2dcc081445dfbf451e0716d43386>:0 at DotnetRuntimeBootstrapper.AppHost.Core.BootstrapperBase.Run (System.String[] args) [0x00044] in <5ede2dcc081445dfbf451e0716d43386>:0 ```
Identical result after: ``` wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh chmod +x ./dotnet-install.sh ./dotnet-install.sh --version latest --runtime aspnetcore ```

As indicated here.

Do not find any issue open or closed when searching ntdll.dll...

you need to make sure that .NET 8.0 Runtime is installed

Source: README.md.

.NET 8 has been published on November 14, 2023.

While sudo apt install dotnet7 works, dotnet8 does not work.

"dotnet8" "mint" does not return any result on DuckDuckGo and with Google only uninteresting results it seems.

Note that .NET seems open-source (source: Wikipedia).

docker run --rm tyrrrz/discordchatexporter:stable
Output: ``` Unable to find image 'tyrrrz/discordchatexporter:stable' locally stable: Pulling from tyrrrz/discordchatexporter 96526aa774ef: Pull complete 81181609316e: Pull complete 97f09781281a: Pull complete 088d41a892ac: Pull complete 95a311871614: Pull complete 9bb6e964ce9a: Pull complete 3eeb952c3e66: Pull complete Digest: sha256:35eb4fb9a11a4f0650450e662120061b87aa1382a35949d798323f8ab6a07b70 Status: Downloaded newer image for tyrrrz/discordchatexporter:stable DiscordChatExporter.Cli v2.42.6 USAGE dotnet DiscordChatExporter.Cli.dll [options] dotnet DiscordChatExporter.Cli.dll [command] [...] OPTIONS -h|--help Shows help text. --version Shows version information. COMMANDS channels Get the list of channels in a guild. dm Gets the list of all direct message channels. export Exports one or multiple channels. exportall Exports all accessible channels. exportdm Exports all direct message channels. exportguild Exports all channels within the specified guild. guide Explains how to obtain the token, guild or channel ID. guilds Gets the list of accessible guilds. You can run `dotnet DiscordChatExporter.Cli.dll [command] --help` to show help on a specific command. ```

works out of the box.

But how to avoid using docker?

How to avoid chmod 777 -R . to not face:

docker run --rm -v $PWD:/out tyrrrz/discordchatexporter:stable exportguild -t "CENSORED" -g CENSORED --media
Output: ``` ┌────────────────────────────────────────────────────────────────────┐ │ Thank you for supporting Ukraine <3 │ │ │ │ As Russia wages a genocidal war against my country, │ │ I'm grateful to everyone who continues to │ │ stand with Ukraine in our fight for freedom. │ │ │ │ Learn more: https://tyrrrz.me/ukraine │ └────────────────────────────────────────────────────────────────────┘ Note: Output streams are redirected, rich console interactions are disabled. If you are running this command in Docker, consider allocating a pseudo-terminal for better user experience (docker run -it ...). Fetching channels... ... Fetched 'AFKs / AFK long (plus de 15 minutes)'. Fetched 29 channel(s). Exporting 29 channel(s)... Administration / discussion-du-staff: 0% ERROR DiscordChatExporter.Core.Exceptions.DiscordChatExporterException: Failed to export message #831560510280957952 in channel 'discussion-du-staff' (#831531101578199040) of guild 'LemnosLife (#831522435475046420)'. System.UnauthorizedAccessException: Access to the path '/out/LemnosLife - Administration - discussion-du-staff [831531101578199040].html' is denied. System.IO.IOException: Permission denied at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.File.Create(String path) at DiscordChatExporter.Core.Exporting.MessageExporter.CreateMessageWriter(String filePath, ExportFormat format, ExportContext context) in /tmp/app/DiscordChatExporter.Core/Exporting/MessageExporter.cs:104 at DiscordChatExporter.Core.Exporting.MessageExporter.GetWriterAsync(CancellationToken cancellationToken) in /tmp/app/DiscordChatExporter.Core/Exporting/MessageExporter.cs:59 at DiscordChatExporter.Core.Exporting.MessageExporter.ExportMessageAsync(Message message, CancellationToken cancellationToken) in /tmp/app/DiscordChatExporter.Core/Exporting/MessageExporter.cs:70 at DiscordChatExporter.Core.Exporting.ChannelExporter.ExportChannelAsync(ExportRequest request, IProgress`1 progress, CancellationToken cancellationToken) in /tmp/app/DiscordChatExporter.Core/Exporting/ChannelExporter.cs:89 at DiscordChatExporter.Core.Exporting.ChannelExporter.ExportChannelAsync(ExportRequest request, IProgress`1 progress, CancellationToken cancellationToken) in /tmp/app/DiscordChatExporter.Core/Exporting/ChannelExporter.cs:94 at DiscordChatExporter.Core.Exporting.ChannelExporter.ExportChannelAsync(ExportRequest request, IProgress`1 progress, CancellationToken cancellationToken) in /tmp/app/DiscordChatExporter.Core/Exporting/ChannelExporter.cs:72 at DiscordChatExporter.Core.Exporting.ChannelExporter.ExportChannelAsync(ExportRequest request, IProgress`1 progress, CancellationToken cancellationToken) in /tmp/app/DiscordChatExporter.Core/Exporting/ChannelExporter.cs:107 at DiscordChatExporter.Cli.Commands.Base.ExportCommandBase.<>c__DisplayClass63_2.<b__2>d.MoveNext() in /tmp/app/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs:228 at DiscordChatExporter.Cli.Utils.Extensions.ConsoleExtensions.StartTaskAsync(ProgressContext context, String description, Func`2 performOperationAsync) in /tmp/app/DiscordChatExporter.Cli/Utils/Extensions/ConsoleExtensions.cs:53 at DiscordChatExporter.Cli.Commands.Base.ExportCommandBase.<>c__DisplayClass63_1.<b__1>d.MoveNext() in /tmp/app/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs:202 at System.Threading.Tasks.Parallel.<>c__53`1.<b__53_0>d.MoveNext() at DiscordChatExporter.Cli.Commands.Base.ExportCommandBase.<>c__DisplayClass63_0.<b__0>d.MoveNext() in /tmp/app/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs:191 at Spectre.Console.Progress.<>c__DisplayClass27_0.<b__0>d.MoveNext() in /_/src/Spectre.Console/Live/Progress/Progress.cs:98 at Spectre.Console.Progress.<>c__DisplayClass28_0`1.<b__0>d.MoveNext() in /_/src/Spectre.Console/Live/Progress/Progress.cs:133 at Spectre.Console.Internal.DefaultExclusivityMode.RunAsync[T](Func`1 func) in /_/src/Spectre.Console/Internal/DefaultExclusivityMode.cs:40 at Spectre.Console.Progress.StartAsync[T](Func`2 action) in /_/src/Spectre.Console/Live/Progress/Progress.cs:116 at Spectre.Console.Progress.StartAsync(Func`2 action) in /_/src/Spectre.Console/Live/Progress/Progress.cs:96 at DiscordChatExporter.Cli.Commands.Base.ExportCommandBase.ExportAsync(IConsole console, IReadOnlyList`1 channels) in /tmp/app/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs:181 at DiscordChatExporter.Cli.Commands.ExportGuildCommand.ExecuteAsync(IConsole console) in /tmp/app/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs:104 at CliFx.CliApplication.RunAsync(ApplicationSchema applicationSchema, CommandInput commandInput) in /_/CliFx/CliApplication.cs:163 at CliFx.CliApplication.RunAsync(IReadOnlyList`1 commandLineArguments, IReadOnlyDictionary`2 environmentVariables) in /_/CliFx/CliApplication.cs:204 ```

Related to Improve_websites_thanks_to_open_source/issues/447.

+5

Version

Not read.

Flavor

CLI (Command-Line Interface)

Platform

Not read.

Export format

No response

Steps to reproduce

Not read.

Details

Not read.

Checklist

Benjamin-Loison commented 2 weeks ago

Could try graphical interface.

Benjamin-Loison commented 2 weeks ago

On Debian 12 GNOME Pegasus Virtual Machine Manager Debian (trust) virtual machine:

FILE=DiscordChatExporter.Cli.linux-x64.zip
wget https://github.com/Tyrrrz/DiscordChatExporter/releases/download/2.43.3/$FILE
unzip $FILE
./DiscordChatExporter.Cli exportguild --guild 933841502155706418 --token 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' --include-threads All --media --reuse-media --fuck-russia
Output: ``` Fetching channels... Fetched 5 channel(s). Fetching threads... Fetched 4 thread(s). Exporting 9 channel(s)... Voice Channels / General \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / general-information \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / announcements \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / general \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / off-topic \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / general / Hello. I'm working on a small project \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / general / Hi there. This video has a Copyright \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / general / what Claude suggested \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Text Channels / general / In case of doubt just running would do \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100% Successfully exported 8 channel(s). Failed to export 1 the following channel(s): Voice Channels / General: Channel 'General' of guild 'YouTube operational API' does not contain any messages. ```

works as wanted.

du -sh YouTube\ operational\ API\ -\ * | sort -h
Output: ``` 24K YouTube operational API - Text Channels - general-information [942945129025650739].html 28K YouTube operational API - general - Hello. I'm working on a small project [1252770832196042804].html 28K YouTube operational API - general - In case of doubt just running would do [1049864739112636456].html 32K YouTube operational API - general - Hi there. This video has a Copyright [1244720453336174613].html 36K YouTube operational API - general - what Claude suggested [1132631692272742420].html 36K YouTube operational API - Text Channels - announcements [1089261136374927511].html 488K YouTube operational API - Text Channels - off-topic [1018941529265553488].html 852K YouTube operational API - general - Hello. I'm working on a small project [1252770832196042804].html_Files 852K YouTube operational API - Text Channels - general-information [942945129025650739].html_Files 856K YouTube operational API - general - Hi there. This video has a Copyright [1244720453336174613].html_Files 864K YouTube operational API - Text Channels - announcements [1089261136374927511].html_Files 1.1M YouTube operational API - general - what Claude suggested [1132631692272742420].html_Files 1.2M YouTube operational API - general - In case of doubt just running would do [1049864739112636456].html_Files 12M YouTube operational API - Text Channels - general [933841503103627316].html 32M YouTube operational API - Text Channels - off-topic [1018941529265553488].html_Files 176M YouTube operational API - Text Channels - general [933841503103627316].html_Files ```
Benjamin-Loison commented 2 weeks ago

Will re-open this issue if notice this issue on another OS for instance.