mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-01 03:09:05 +00:00
Fixed script and added '-WindowStyle Hidden' and '-ExecutionPolicy ByPass' to taskschd command
@@ -1,55 +1,54 @@
|
||||
We'll be using [DiscordChatExporter CLI](https://github.com/Tyrrrz/DiscordChatExporter/releases/latest), Powershell and Task Scheduler.
|
||||
We'll be using [DiscordChatExporter CLI](https://github.com/Tyrrrz/DiscordChatExporter/releases/latest), PowerShell and Task Scheduler.
|
||||
#
|
||||
|
||||
**1.** Open a text editor such as Notepad and paste:
|
||||
```powershell
|
||||
# Info: https://github.com/Tyrrrz/DiscordChatExporter/wiki
|
||||
|
||||
$TOKEN = "<token>"
|
||||
$TOKENTYPE = "<BOT/USER>"
|
||||
$CHANNEL = "<channel>"
|
||||
$EXEPATH = "<exe>"
|
||||
$FILENAME = "<name>"
|
||||
$EXPORTDIRECTORY = "<dir>"
|
||||
$EXPORTFORMAT = "<format>"
|
||||
$TOKEN = "token"
|
||||
$TOKENTYPE = "BOT/USER"
|
||||
$CHANNEL = "channel"
|
||||
$EXEPATH = "exe"
|
||||
$FILENAME = "name"
|
||||
$EXPORTDIRECTORY = "dir"
|
||||
$EXPORTFORMAT = "format"
|
||||
# Available export formats: PlainText, HtmlDark, HtmlLight, Csv
|
||||
|
||||
cd $EXEPATH
|
||||
|
||||
If($TOKENTYPE -match "BOT"){$ISBOTYES = "-b"}
|
||||
Else{$ISBOTYES = ""}
|
||||
.\DiscordChatExporter.Cli.exe export -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o exporttmp
|
||||
.\DiscordChatExporter.Cli.exe export -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o export.tmp
|
||||
|
||||
$Date = Get-Date -Format "yyyy-MM-dd HH-mm"
|
||||
|
||||
If($EXPORTFORMAT -match "PlainText"){mv exporttmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.txt"}
|
||||
ElseIf($EXPORTFORMAT -match "HtmlDark"){mv exporttmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.html"}
|
||||
ElseIf($EXPORTFORMAT -match "HtmlLight"){mv exporttmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.html"}
|
||||
ElseIf($EXPORTFORMAT -match "Csv"){mv exporttmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.csv"}
|
||||
If($EXPORTFORMAT -match "PlainText"){mv export.tmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.txt"}
|
||||
ElseIf($EXPORTFORMAT -match "HtmlDark"){mv export.tmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.html"}
|
||||
ElseIf($EXPORTFORMAT -match "HtmlLight"){mv export.tmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.html"}
|
||||
ElseIf($EXPORTFORMAT -match "Csv"){mv export.tmp -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.csv"}
|
||||
exit
|
||||
```
|
||||
|
||||
**2.** Replace:
|
||||
|
||||
`<token>` with your [Token](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
|
||||
`token` with your [Token](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
|
||||
|
||||
`<BOT/USER>` If the Token is from a bot replace it with `BOT`, if it's from a user, `USER`
|
||||
`BOT/USER` If the Token is from a bot replace it with `BOT`, if it's from a user, `USER`
|
||||
|
||||
`<channel>` with a [Channel ID](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
|
||||
`channel` with a [Channel ID](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
|
||||
|
||||
`<exe>` with the .exe directory path (e.g. C:\Users\User\Desktop\DiscordChatExporter)
|
||||
`exe` with the .exe **directory's path** (e.g. C:\Users\User\Desktop\DiscordChatExporter)
|
||||
|
||||
`<name>` with a filename without spaces
|
||||
`name` with a filename without spaces
|
||||
|
||||
`<dir>` with the export directory (e.g. C:\Users\User\Documents\Exports)
|
||||
`dir` with the export directory (e.g. C:\Users\User\Documents\Exports)
|
||||
|
||||
`<format>` with one of the available export formats
|
||||
`format` with one of the available export formats
|
||||
|
||||
Make sure not to delete the quotes (")
|
||||
|
||||
**3.** Save the file as `filename.ps1` not `.txt`
|
||||
|
||||
|
||||
## Export at Startup
|
||||
|
||||
**1.** Press Windows + R, type `shell:startup` and press ENTER
|
||||
@@ -69,7 +68,7 @@ Please notice your computer must be turned on so the exportation can occur.
|
||||
|
||||
[  ](https://i.imgur.com/3gHkF0t.png)
|
||||
|
||||
**3.** At 'Start a Program', write `powershell -file "C:\path\to\filename.ps1"` in Program/script text box
|
||||
**3.** At 'Start a Program', write `powershell -file -ExecutionPolicy ByPass -WindowStyle Hidden "C:\path\to\filename.ps1"` in the Program/script text box
|
||||
|
||||

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