Updated Docker usage instructions (markdown)

Yudi
2018-12-04 17:40:57 -02:00
parent 94db2f9ee9
commit 06feb32095

@@ -1,5 +1,3 @@
### Usage with session token and ID of channel
To pull the latest version:
$ docker pull tyrrrz/discordchatexporter
@@ -8,66 +6,57 @@ To export:
$ docker run tyrrrz/discordchatexporter export -t TOKEN -c CHANNEL
##
To export using a Bot Token just add `-b`:
### Usage with a bot instead of a session token
$ docker run tyrrrz/discordchatexporter export -t TOKEN -c CHANNEL -b
To get list of guilds available to a bot:
The CLI options can be found at:
$ docker run tyrrrz/discordchatexporter guilds -t TOKEN -b
$ docker run -it tyrrrz/discordchatexporter
#
To get list of channel available to a bot on a given guild:
A docker image's export path is in /a, to export the file to host use:
$ docker run tyrrrz/discordchatexporter channels -t TOKEN -b -g GUILD_ID
$ docker run -v $PWD:/a tyrrrz/discordchatexporter export -t TOKEN -c CHANNEL
To get content of channel:
#
$ docker run tyrrrz/discordchatexporter export -t TOKEN -b -c CHANNEL
A script to gather every channel you're on:
Export path is in /a in docker image, so if you need to bring the file on the host use the following command:
#!/usr/bin/env bash
# Info: https://github.com/Tyrrrz/DiscordChatExporter/wiki
TOKEN=<token>
TOKENTYPE=<BOT/USER>
$ docker run -v $PWD:/a tyrrrz/discordchatexporter export -t TOKEN -b -c CHANNEL
And finally a small script to gather every channel your bot is on:
```bash
MY_TOKEN_ID=<TOKEN ID HERE>
# get list of guilds
guilds=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter guilds -t $MY_TOKEN_ID -b | 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 processing $guild_name with id $guild_id
channels=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter channels -t $MY_TOKEN_ID -b -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 processing $channel_name in guild $guild_name with channel id: $channel_id
result=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter export -t $MY_TOKEN_ID -b -c $channel_id -o /a/${guild_name}_${channel_name}.html)
if [ ! $? ]; then
echo an error happenned: $result
exit 1
else
echo channel saved as ${guild_name}_${channel_name}.html
if [[ "$TOKENTYPE" == "BOT" ]]; then
ISBOTYES=-b
fi
done
done
```
List of options for cli call from [ExportChatOption.cs](https://github.com/Tyrrrz/DiscordChatExporter/blob/master/DiscordChatExporter.Cli/Verbs/Options/ExportChatOptions.cs):
guilds=$(docker run --rm -v $PWD:/a tyrrrz/discordchatexporter guilds -t $TOKEN $ISBOTYES | tr -d '[:blank:]')
-c|--channel <channel_id>
[-f|--format] <PlainText|HtmlDark|HtmlLight|Csv>
[-o|--ouptput] <path to output file>
[--after] <limit export to messages after this date>
[--before] <limit export to messages before this date>
[-p|--partition] <split output by this amount of messages>
[--dateformat] <date format>
[--grouplimit] <messages group limit>
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
##
Credits to [@simnalamburt](https://github.com/simnalamburt)
Special thanks to [@simnalamburt](https://github.com/simnalamburt) (Dockerize) and [@shlagevuk](https://github.com/shlagevuk) (Script)