diff --git a/dlphelper/discord.py b/dlphelper/discord.py index 8493e29..89e8025 100644 --- a/dlphelper/discord.py +++ b/dlphelper/discord.py @@ -48,8 +48,9 @@ class FoundUrl: def export_channel(channel_id: str, out_dir: Path, token: str, force: bool = False) -> Path: """Export the channel to out_dir/export.json using the DCE docker image. - The token is passed to the container via the TOKEN env var (DCE reads it - natively) so it never appears on the docker command line. + The token is passed to the container via the DISCORD_TOKEN env var (DCE + reads it natively) so it never appears on the docker command line. TOKEN + is set as well for DCE versions that only know that name. """ dest = out_dir / "export.json" if dest.exists() and not force: @@ -58,11 +59,13 @@ def export_channel(channel_id: str, out_dir: Path, token: str, force: bool = Fal out_dir.mkdir(parents=True, exist_ok=True) env = dict(os.environ) + env["DISCORD_TOKEN"] = token env["TOKEN"] = token cmd = [ "docker", "run", "--rm", "--user", f"{os.getuid()}:{os.getgid()}", "-v", f"{out_dir.resolve()}:/out", + "-e", "DISCORD_TOKEN", "-e", "TOKEN", DCE_IMAGE, "export", "-c", channel_id, "-f", "Json", "-o", "/out/export.json",