DiscordChatExporter用個人設定
DiscordChatExporter個人設定
directory schema
code:structure
~/discord-archive/
├─ meta/
│ ├─ server1/
│ │ ├─ channels
│ │ └─ exclude.channels
│ └─ serverN/
│ │ ├─ channels
│ │ └─ exclude.channels
├─ files/
│ ├─ server1/
│ └─ serverN/
└─ guilds
the files under serverN/ *channels must be text data format, and the content to be sorted with channel id.
guilds
The file guild should be updated frequently because the shellscript execute reads it when it is launched.
The file can be sorted, but not obligatory.
When you update the guild file, it should be done in this way.
code:sh
DiscordChatExporter.Cli guilds | sort -nk1 > ~/discord-archive/guilds
maintainance
This script filters channels that does not appear in exclude.channels.
code:execute.sh
GUILD_ID=$1
GUILD_FILE=~/discord-archive/guilds
. ~/.bashrc
if $BASH_ARGC -lt 1 ; then
echo "error: specify a guild id"
exit 1
fi
if ! -f "$GUILD_FILE" ; then
echo "error: the guild file '$GUILD_FILE' does not exist"
exit 1
fi
awk '{print $1}' $GUILD_FILE | grep -we "$GUILD_ID"
if $? -eq 1 ; then
echo "error: the guild '$1' was not found in the guild file '$GUILD_FILE'"
exit 1
fi
mkdir --parent --verbose ~/discord-archive/files/"$GUILD_ID"
cat ~/discord-archive/meta/"$GUILD_ID"/exclude.channels <(awk '{print $1}' ~/discord-archive/meta/"$GUILD_ID"/channels) | \
sort -n | \
uniq -u | \
xargs \
docker run \
--rm \
-v ~/discord-archive/files/"$GUILD_ID":/out \
tyrrrz/discordchatexporter:stable export \
-t "$DISCORD_TOKEN" \
--locale ja_JP \
--media \
--reuse-media \
--markdown false \
--format Json \
--channel
未実装
meta/以下のファイルがないときに警告して終了する
files