diff --git a/Docker-usage-instructions.md b/Docker-usage-instructions.md index 303fb71..e72aee5 100644 --- a/Docker-usage-instructions.md +++ b/Docker-usage-instructions.md @@ -21,42 +21,42 @@ A docker image's export path is in /a, to export the file to host use: # -A script to gather every channel you're on: +A script to export every channel you're on: +``` +#!/bin/bash +# Info: https://github.com/Tyrrrz/DiscordChatExporter/wiki +MY_TOKEN_ID= +TOKENTYPE= - #!/usr/bin/env bash - # Info: https://github.com/Tyrrrz/DiscordChatExporter/wiki - TOKEN= - TOKENTYPE= +if [[ "$TOKENTYPE" == "BOT" ]]; then +ISBOTYES=-b +fi - if [[ "$TOKENTYPE" == "BOT" ]]; then - ISBOTYES=-b +# get list of guilds +guilds=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter guilds -t $MY_TOKEN_ID $ISBOTYES | tr -d '[:blank:]') + +for guild in $guilds; do + guild_id=$(echo $guild | cut -d '|' -f 1) + guild_name=$(echo $guild | cut -d '|' -f 2) + echo "Guild: $guild_name - $guild_id" + + channels=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter channels -t $MY_TOKEN_ID $ISBOTYES -g $guild_id | tr -d '[:blank:]') + for channel in $channels; do + channel_id=$(echo $channel | cut -d '|' -f 1) + channel_name=$(echo $channel | cut -d '|' -f 2) + + echo "Channel: $channel_name - $channel_id at $guild_name" + result=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter export -t $MY_TOKEN_ID $ISBOTYES -c $channel_id -o /a/${guild_name}_${channel_name}.html) + if [ ! $? ]; then + echo "Something went wrong:" + echo "$result" + exit + else + echo "File saved as ${guild_name}_${channel_name}.html" fi - - guilds=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter guilds -t $TOKEN $ISBOTYES | tr -d '[:blank:]') - - for guild in $guilds; do - guild_id=$(echo $guild | cut -d '|' -f 1) - guild_name=$(echo $guild | cut -d '|' -f 2) - echo "Guild: $guild_name - $guild_id" - - channels=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter channels -t $TOKEN $ISBOTYES -g $guild_id | tr -d '[:blank:]') - for channel in $channels; do - channel_id=$(echo $channel | cut -d '|' -f 1) - channel_name=$(echo $channel | cut -d '|' -f 2) - - echo "Channel: $channel_name - $channel_id" - echo "Guild: $guild_name - $guild_id" - result=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter export -t $TOKEN $ISBOTYES -c $channel_id -o /a/${guild_name}_${channel_name}.html) - if [ ! $? ]; then - echo "Something went wrong: $result" - exit - else - echo "File saved as ${guild_name}_${channel_name}.html" - exit - fi - done - done - exit - + done +done +exit +``` ## Special thanks to [@simnalamburt](https://github.com/simnalamburt) (Dockerize) and [@shlagevuk](https://github.com/shlagevuk) (Script) \ No newline at end of file