mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-05-26 18:52:05 +00:00
Updated Scheduling exports with Mono & Crontab (markdown)
@@ -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
|
cd $EXEPATH || exit
|
||||||
|
|
||||||
@@ -29,21 +30,25 @@ 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 exporttmp
|
mono DiscordChatExporter.Cli.exe export -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o export.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 "exporttmp" ${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt
|
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt"
|
||||||
|
|
||||||
elif [[ "$EXPORTFORMAT" == "Html"* ]]; then
|
elif [[ "$EXPORTFORMAT" == "Html"* ]]; then
|
||||||
mv "exporttmp" ${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html
|
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html"
|
||||||
|
|
||||||
elif [[ "$EXPORTFORMAT" == "Csv" ]]; then
|
elif [[ "$EXPORTFORMAT" == "Csv" ]]; then
|
||||||
mv "exporttmp" ${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv
|
mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv"
|
||||||
else
|
else
|
||||||
exit
|
echo "$EXPORTFORMAT - Unknown export format"
|
||||||
|
if ! rm -Rf "export.tmp" ; then
|
||||||
|
echo "Unable to delete $PWD/export.tmp"
|
||||||
fi
|
fi
|
||||||
exit
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
```
|
```
|
||||||
|
|
||||||
**3.** Replace:
|
**3.** Replace:
|
||||||
@@ -58,10 +63,12 @@ exit
|
|||||||
|
|
||||||
`<name>` with a filename without spaces
|
`<name>` with a filename without spaces
|
||||||
|
|
||||||
`<dir>` with the export directory (e.g. /home/user/Documents/CronExport)
|
`<dir>` with the export directory (e.g. /home/user/Documents/Discord\ Exports)
|
||||||
|
|
||||||
`<format>` with one of the available export formats
|
`<format>` with one of the available export formats
|
||||||
|
|
||||||
|
**Remember to escape spaces** (add `\` before spaces)!<br/><br/>
|
||||||
|
|
||||||
**4.** Give the shell script permissions with `sudo chmod 755 /path/to/DiscordChatExporter/cron.sh`
|
**4.** Give the shell script permissions with `sudo chmod 755 /path/to/DiscordChatExporter/cron.sh`
|
||||||
|
|
||||||
**5.** Add a new job to crontab using `sudo crontab –e`
|
**5.** Add a new job to crontab using `sudo crontab –e`
|
||||||
|
|||||||
Reference in New Issue
Block a user