Advertisement
zetlnd

Untitled

Jan 21st, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.29 KB | None | 0 0
  1. # Using the CLI
  2.  
  3. ## Guide
  4.  
  5. > **Note**:
  6. > Make sure you have [.NET Core installed](Dotnet.md) before attempting to run the commands below.
  7. > **Docker** users, please refer to the [Docker usage instructions](Docker.md).
  8.  
  9. ## Step 1
  10.  
  11. After extracting the `.zip`, open Command Prompt, aka `cmd` (`Terminal` on **macOS** and **Linux**).
  12.  
  13. ## Step 2
  14.  
  15. Change the current directory to DCE's folder with `cd C:\path\to\directory`, then press ENTER to run the command.
  16.  
  17. **Windows** users can quickly get the directory's path by clicking the address bar while inside the folder.
  18. ![Copy path from Explorer](https://i.imgur.com/XncnhC2.gif)
  19.  
  20. **macOS** users can select the `.exe`, hit Command+I (⌘I), and copy what's after `Where:` to get the directory
  21. ![Mac info panel](https://camo.githubusercontent.com/3c51a904b0099c9f68a4797461d4a7914902fc04/68747470733a2f2f692e696d6775722e636f6d2f323975364e79782e706e67)
  22.  
  23. You can also drag and drop the folder on **every platform**.
  24. ![Drag and drop folder](https://i.imgur.com/sOpZQAb.gif)
  25.  
  26. ## Step 3
  27.  
  28. Now we're ready to run the commands. The examples on this page follow the Windows file path format, change the file
  29. paths according to your system.
  30.  
  31. Type the following in Command Prompt (Terminal), then press ENTER to run it. This will list DCE's options.
  32.  
  33. ```console
  34. dotnet DiscordChatExporter.Cli.dll
  35. ```
  36.  
  37. > **Docker** users, please refer to the [Docker usage instructions](Docker.md).
  38.  
  39. ## CLI commands
  40.  
  41. | Command | Description |
  42. |-------------------------|------------------------------------------------------|
  43. | export | Exports a channel |
  44. | exportdm | Exports all direct message channels |
  45. | exportguild | Exports all channels within the specified server |
  46. | exportall | Exports all accessible channels |
  47. | channels | Outputs the list of channels in the given server |
  48. | dm | Outputs the list of direct message channels |
  49. | guilds | Outputs the list of accessible servers |
  50. | guide | Explains how to obtain token, server, and channel ID |
  51.  
  52. To use the commands, you'll need a token. For the instructions on how to get a token, please refer to [this page](Token-and-IDs.md), or run `dotnet DiscordChatExporter.Cli.dll guide`.
  53.  
  54. To get help with a specific command, run:
  55.  
  56. ```console
  57. dotnet DiscordChatExporter.Cli.dll command --help
  58. ```
  59.  
  60. For example, to figure out how to use the `export` command, run:
  61.  
  62. ```console
  63. dotnet DiscordChatExporter.Cli.dll export --help
  64. ```
  65.  
  66. ## Export a specific channel
  67.  
  68. You can quickly export with DCE's default settings by using just `-t token` and `-c channelid`.
  69.  
  70. ```console
  71. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555
  72. ```
  73.  
  74. #### Changing the format
  75.  
  76. You can change the export format to `HtmlDark`, `HtmlLight`, `PlainText` `Json` or `Csv` with `-f format`. The default
  77. format is `HtmlDark`.
  78.  
  79. ```console
  80. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -f Json
  81. ```
  82.  
  83. #### Changing the output filename
  84.  
  85. You can change the filename by using `-o name.ext`. e.g. for the `HTML` format:
  86.  
  87. ```console
  88. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -o myserver.html
  89. ```
  90.  
  91. #### Changing the output directory
  92.  
  93. You can change the export directory by using `-o` and providing a path that ends with a slash or does not have a file
  94. extension.
  95. If any of the folders in the path have a space in its name, escape them with quotes (").
  96.  
  97. ```console
  98. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -o "C:\Discord Exports"
  99. ```
  100.  
  101. #### Changing the filename and output directory
  102.  
  103. You can change both the filename and export directory by using `-o directory\name.ext`.
  104. Note that the filename must have an extension, otherwise it will be considered a directory name.
  105. If any of the folders in the path have a space in its name, escape them with quotes (").
  106.  
  107. ```console
  108. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -o "C:\Discord Exports\myserver.html"
  109. ```
  110.  
  111. #### Generating the filename and output directory dynamically
  112.  
  113. You can use template tokens to generate the output file path based on the server and channel metadata.
  114.  
  115. ```console
  116. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -o "C:\Discord Exports\%G\%T\%C.html"
  117. ```
  118.  
  119. Assuming you are exporting a channel named `"my-channel"` in the `"Text channels"` category from a server
  120. called `"My server"`, you will get the following output file
  121. path: `C:\Discord Exports\My server\Text channels\my-channel.html`
  122.  
  123. Here is the full list of supported template tokens:
  124.  
  125. - `%g` - server ID
  126. - `%G` - server name
  127. - `%t` - category ID
  128. - `%T` - category name
  129. - `%c` - channel ID
  130. - `%C` - channel name
  131. - `%p` - channel position
  132. - `%P` - category position
  133. - `%a` - the "after" date
  134. - `%b` - the "before" date
  135. - `%%` - escapes `%`
  136.  
  137. #### Partitioning
  138.  
  139. You can use partitioning to split files after a given number of messages or file size.
  140. For example, a channel with 36 messages set to be partitioned every 10 messages will output 4 files.
  141.  
  142. ```console
  143. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -p 10
  144. ```
  145.  
  146. A 45 MB channel set to be partitioned every 20 MB will output 3 files.
  147.  
  148. ```console
  149. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 -p 20mb
  150. ```
  151.  
  152. #### Downloading assets
  153.  
  154. If this option is set, the export will include additional files such as user avatars, attached files, images, etc.
  155. Only files that are referenced by the export are downloaded, which means that, for example, user avatars will not be
  156. downloaded when using the plain text (TXT) export format.
  157. A folder containing the assets will be created along with the exported chat. They must be kept together.
  158.  
  159. ```console
  160. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --media
  161. ```
  162.  
  163. #### Reusing assets
  164.  
  165. Previously downloaded assets can be reused to skip redundant downloads as long as the chat is always exported to the
  166. same folder. Using this option can speed up future exports. This option requires the `--media` option.
  167.  
  168. ```console
  169. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --media --reuse-media
  170. ```
  171.  
  172. #### Changing the media directory
  173.  
  174. By default, the media directory is created alongside the exported chat. You can change this by using `--media-dir` and
  175. providing a path that ends with a slash. All of the exported media will be stored in this directory.
  176.  
  177. ```console
  178. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --media --media-dir "C:\Discord Media"
  179. ```
  180.  
  181. #### Changing the date format
  182.  
  183. You can customize how dates are formatted in the exported files by using `--locale` and inserting one of Discord's
  184. locales. The default locale is `en-US`.
  185.  
  186. ```console
  187. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --locale "de-DE"
  188. ```
  189.  
  190. #### Date ranges
  191.  
  192. **Messages sent before a date**
  193. Use `--before` to export messages sent before the provided date. E.g. messages sent before September 18th, 2019:
  194.  
  195. ```console
  196. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --before 2019-09-18
  197. ```
  198.  
  199. **Messages sent after a date**
  200. Use `--after` to export messages sent after the provided date. E.g. messages sent after September 17th, 2019 11:34 PM:
  201.  
  202. ```console
  203. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --after "2019-09-17 23:34"
  204. ```
  205.  
  206. **Messages sent in a date range**
  207. Use `--before` and `--after` to export messages sent during the provided date range. E.g. messages sent between
  208. September 17th, 2019 11:34 PM and September 18th:
  209.  
  210. ```console
  211. dotnet DiscordChatExporter.Cli.dll export -t "mfa.Ifrn" -c 53555 --after "2019-09-17 23:34" --before "2019-09-18"
  212. ```
  213.  
  214. You can try different formats like `17-SEP-2019 11:34 PM` or even refine your ranges down to
  215. milliseconds `17-SEP-2019 23:45:30.6170`!
  216. Don't forget to quote (") the date if it has spaces!
  217. More info about .NET date
  218. formats [here](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings).
  219.  
  220. ### Export channels from a specific server
  221.  
  222. To export all channels in a specific server, use the `exportguild` command and provide the server ID through the `-g|--guild` option:
  223.  
  224. ```console
  225. dotnet DiscordChatExporter.Cli.dll exportguild -t "mfa.Ifrn" -g 21814
  226. ```
  227.  
  228. #### Including threads
  229.  
  230. By default, threads are not included in the export. You can change this behavior by using `--include-threads` and
  231. specifying which threads should be included. It has possible values of `none`, `active`, or `all`, indicating which
  232. threads should be included. To include both active and archived threads, use `--include-threads all`.
  233.  
  234. ```console
  235. dotnet DiscordChatExporter.Cli.dll exportguild -t "mfa.Ifrn" -g 21814 --include-threads all
  236. ```
  237.  
  238. #### Including voice channels
  239.  
  240. By default, voice channels are included in the export. You can change this behavior by using `--include-vc` and
  241. specifying whether to include voice channels in the export. It has possible values of `true` or `false`, to exclude
  242. voice channels, use `--include-vc false`.
  243.  
  244. ```console
  245. dotnet DiscordChatExporter.Cli.dll exportguild -t "mfa.Ifrn" -g 21814 --include-vc false
  246. ```
  247.  
  248. ### Export all channels
  249.  
  250. To export all accessible channels, use the `exportall` command:
  251.  
  252. ```console
  253. dotnet DiscordChatExporter.Cli.dll exportall -t "mfa.Ifrn"
  254. ```
  255.  
  256. #### Excluding DMs
  257.  
  258. To exclude DMs, add the `--include-dm false` option.
  259.  
  260. ```console
  261. dotnet DiscordChatExporter.Cli.dll exportall -t "mfa.Ifrn" --include-dm false
  262. ```
  263.  
  264. ### List channels in a server
  265.  
  266. To list the channels available in a specific server, use the `channels` command and provide the server ID through the `-g|--guild` option:
  267.  
  268. ```console
  269. dotnet DiscordChatExporter.Cli.dll channels -t "mfa.Ifrn" -g 21814
  270. ```
  271.  
  272. ### List direct message channels
  273.  
  274. To list all DM channels accessible to the current account, use the `dm` command:
  275.  
  276. ```console
  277. dotnet DiscordChatExporter.Cli.dll dm -t "mfa.Ifrn"
  278. ```
  279.  
  280. ### List servers
  281.  
  282. To list all servers accessible by the current account, use the `guilds` command:
  283.  
  284. ```console
  285. dotnet DiscordChatExporter.Cli.dll guilds -t "mfa.Ifrn" > C:\path\to\output.txt
  286. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement