From 06feb320955563a6a75904b6a944d990784725c8 Mon Sep 17 00:00:00 2001 From: Yudi Date: Tue, 4 Dec 2018 17:40:57 -0200 Subject: [PATCH] Updated Docker usage instructions (markdown) --- Docker-usage-instructions.md | 91 ++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 51 deletions(-) diff --git a/Docker-usage-instructions.md b/Docker-usage-instructions.md index f9e00bf..303fb71 100644 --- a/Docker-usage-instructions.md +++ b/Docker-usage-instructions.md @@ -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= + TOKENTYPE= - $ 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= - -# 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 - [-f|--format] - [-o|--ouptput] - [--after] - [--before] - [-p|--partition] - [--dateformat] - [--grouplimit] + 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) \ No newline at end of file +Special thanks to [@simnalamburt](https://github.com/simnalamburt) (Dockerize) and [@shlagevuk](https://github.com/shlagevuk) (Script) \ No newline at end of file