mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-23 06:24:48 +00:00
Improved script to be able to handle multiple export tasks at the same directory
@@ -20,6 +20,7 @@ FILENAME=<name>
|
|||||||
EXPORTDIRECTORY=<dir>
|
EXPORTDIRECTORY=<dir>
|
||||||
EXPORTFORMAT=<format>
|
EXPORTFORMAT=<format>
|
||||||
# Available export formats: PlainText, HtmlDark, HtmlLight, Csv
|
# Available export formats: PlainText, HtmlDark, HtmlLight, Csv
|
||||||
|
# /\ CaSe-SeNsItIvE /\
|
||||||
|
|
||||||
cd $EXEPATH || exit 1
|
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
|
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")
|
CURRENTTIME=$(date +"%Y-%m-%d-%H-%M-%S")
|
||||||
|
|
||||||
if [[ "$EXPORTFORMAT" == "PlainText" ]]; then
|
if [[ "$EXPORTFORMAT" == "PlainText" ]]; then
|
||||||
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt"
|
mv "$FILENAME.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt"
|
||||||
|
|
||||||
elif [[ "$EXPORTFORMAT" == "Html"* ]]; then
|
elif [[ "$EXPORTFORMAT" == "HtmlDark" ]] || [[ "$EXPORTFORMAT" == "HtmlLight" ]]; then
|
||||||
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html"
|
mv "$FILENAME.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html"
|
||||||
|
|
||||||
elif [[ "$EXPORTFORMAT" == "Csv" ]]; then
|
elif [[ "$EXPORTFORMAT" == "Csv" ]]; then
|
||||||
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv"
|
mv "$FILENAME.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv"
|
||||||
else
|
else
|
||||||
echo "$EXPORTFORMAT - Unknown export format"
|
echo "$EXPORTFORMAT - Unknown export format"
|
||||||
if ! rm -Rf "export.tmp" ; then
|
echo "Available export formats: PlainText, HtmlDark, HtmlLight, Csv"
|
||||||
echo "Unable to delete $PWD/export.tmp"
|
echo "/\ CaSe-SeNsItIvE /\\"
|
||||||
|
if ! rm -Rf "$FILENAME.tmp" ;then
|
||||||
|
echo "Unable to delete $PWD/$FILENAME.tmp"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user