mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-03 12:19:02 +00:00
Improved script to be able to handle multiple export tasks at the same directory
@@ -20,6 +20,7 @@ FILENAME=<name>
|
||||
EXPORTDIRECTORY=<dir>
|
||||
EXPORTFORMAT=<format>
|
||||
# Available export formats: PlainText, HtmlDark, HtmlLight, Csv
|
||||
# /\ CaSe-SeNsItIvE /\
|
||||
|
||||
cd $EXEPATH || exit 1
|
||||
|
||||
@@ -29,21 +30,23 @@ fi
|
||||
|
||||
PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
mono DiscordChatExporter.Cli.exe export -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o export.tmp
|
||||
mono DiscordChatExporter.Cli.exe export -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o $FILENAME.tmp
|
||||
CURRENTTIME=$(date +"%Y-%m-%d-%H-%M-%S")
|
||||
|
||||
if [[ "$EXPORTFORMAT" == "PlainText" ]]; then
|
||||
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt"
|
||||
mv "$FILENAME.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt"
|
||||
|
||||
elif [[ "$EXPORTFORMAT" == "Html"* ]]; then
|
||||
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html"
|
||||
elif [[ "$EXPORTFORMAT" == "HtmlDark" ]] || [[ "$EXPORTFORMAT" == "HtmlLight" ]]; then
|
||||
mv "$FILENAME.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html"
|
||||
|
||||
elif [[ "$EXPORTFORMAT" == "Csv" ]]; then
|
||||
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv"
|
||||
mv "$FILENAME.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv"
|
||||
else
|
||||
echo "$EXPORTFORMAT - Unknown export format"
|
||||
if ! rm -Rf "export.tmp" ; then
|
||||
echo "Unable to delete $PWD/export.tmp"
|
||||
echo "Available export formats: PlainText, HtmlDark, HtmlLight, Csv"
|
||||
echo "/\ CaSe-SeNsItIvE /\\"
|
||||
if ! rm -Rf "$FILENAME.tmp" ;then
|
||||
echo "Unable to delete $PWD/$FILENAME.tmp"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user