Fix code

Yudi
2018-12-04 23:42:23 -02:00
parent 06feb32095
commit 43837cfe50

@@ -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=<TOKEN>
TOKENTYPE=<BOT/USER>
#!/usr/bin/env bash if [[ "$TOKENTYPE" == "BOT" ]]; then
# Info: https://github.com/Tyrrrz/DiscordChatExporter/wiki ISBOTYES=-b
TOKEN=<token> fi
TOKENTYPE=<BOT/USER>
if [[ "$TOKENTYPE" == "BOT" ]]; then # get list of guilds
ISBOTYES=-b guilds=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter guilds -t $MY_TOKEN_ID $ISBOTYES | tr -d '[:blank:]')
fi
guilds=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter guilds -t $TOKEN $ISBOTYES | tr -d '[:blank:]') for guild in $guilds; do
for guild in $guilds; do
guild_id=$(echo $guild | cut -d '|' -f 1) guild_id=$(echo $guild | cut -d '|' -f 1)
guild_name=$(echo $guild | cut -d '|' -f 2) guild_name=$(echo $guild | cut -d '|' -f 2)
echo "Guild: $guild_name - $guild_id" 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:]') 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 for channel in $channels; do
channel_id=$(echo $channel | cut -d '|' -f 1) channel_id=$(echo $channel | cut -d '|' -f 1)
channel_name=$(echo $channel | cut -d '|' -f 2) channel_name=$(echo $channel | cut -d '|' -f 2)
echo "Channel: $channel_name - $channel_id" echo "Channel: $channel_name - $channel_id at $guild_name"
echo "Guild: $guild_name - $guild_id" 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)
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 if [ ! $? ]; then
echo "Something went wrong: $result" echo "Something went wrong:"
echo "$result"
exit exit
else else
echo "File saved as ${guild_name}_${channel_name}.html" echo "File saved as ${guild_name}_${channel_name}.html"
exit
fi fi
done done
done done
exit exit
```
## ##
Special thanks to [@simnalamburt](https://github.com/simnalamburt) (Dockerize) and [@shlagevuk](https://github.com/shlagevuk) (Script) Special thanks to [@simnalamburt](https://github.com/simnalamburt) (Dockerize) and [@shlagevuk](https://github.com/shlagevuk) (Script)