From e9d82ed236ba79b70d47ab41ea24ddab35c67d8d Mon Sep 17 00:00:00 2001
From: Yudi <12040397+Yudi@users.noreply.github.com>
Date: Sat, 3 May 2025 22:00:34 -0300
Subject: [PATCH] Address token reset concerns
---
.docs/Token-and-IDs.md | 59 +++++++++++++++----
.github/workflows/main.yml | 4 +-
.../DiscordChatExporter.Cli.Tests.csproj | 8 +--
.../Commands/GuideCommand.cs | 5 +-
.../DiscordChatExporter.Cli.csproj | 4 +-
.../DiscordChatExporter.Core.csproj | 2 +-
.../DiscordChatExporter.Gui.csproj | 8 +--
.../Views/Components/DashboardView.axaml | 6 ++
DiscordChatExporter.Gui/Views/MainView.axaml | 2 +-
9 files changed, 72 insertions(+), 26 deletions(-)
diff --git a/.docs/Token-and-IDs.md b/.docs/Token-and-IDs.md
index f34c0c3a..0e7e673a 100644
--- a/.docs/Token-and-IDs.md
+++ b/.docs/Token-and-IDs.md
@@ -1,10 +1,11 @@
# Obtaining Token and Channel IDs
-> **Warning**:
-> **Do not share your token!**
-> A token gives full access to an account. To reset a user token, change your account password. To reset a bot token, click on [Reset Token](#how-to-get-a-bot-token) in the bot settings.
+> [!WARNING]
+> **Do not share your token!** A token gives full access to an account.
+> To reset a user token, change your account password.
+> To reset a bot token, click on [Reset Token](#how-to-export-using-a-bot-token) in the bot settings.
-## How to get a User Token
+## How to get a user token
**Caution:** [Automating user accounts violates Discord's terms of service](https://support.discord.com/hc/en-us/articles/115002192352-Automated-user-accounts-self-bots-) and may result in account termination. Use at your own risk.
@@ -254,7 +255,47 @@ Prerequisite step: Navigate to [discord.com](https://discord.com) and login.
4. Press Esc. The settings page will close.
5. To find your user token, continue [here](#in-chrome).
-## How to get a Bot Token
+## How to export with a bot token
+
+### Step 1 - Create an application
+
+You can use an already existing application, or create a new one. If you'd like to create a new one:
+
+1. Go to [Discord developer portal](https://discord.com/developers/applications)
+2. Click on **New Application** in the top right corner
+3. Enter a name for your application and click **Create**
+
+### Step 2 - Invite the bot to your server
+
+The bot needs to be invited to the server you'd like to export from.
+
+1. Go to [Discord developer portal](https://discord.com/developers/applications)
+2. Navigate to **General Information** on the left
+3. Copy the **Application ID**
+4. Open the following URL in your browser, replacing `YOUR_APP_ID` with the copied Client ID:
+
+
+
+```
+https://discord.com/oauth2/authorize?scope=bot&permissions=66560&client_id=YOUR_APP_ID
+```
+
+### Step 3 - Ensure message content intent is enabled
+
+If this option is not enabled, the exported files will be empty.
+
+1. Go to [Discord developer portal](https://discord.com/developers/applications)
+2. Open your Application's settings
+3. Navigate to the **Bot** section on the left
+4. Scroll down to the **Privileged Gateway Intents** section
+5. Enable **Message Content Intent** by toggling the switch
+
+
+
+### Step 4 - Copy the bot token
+
+If you don't have a bot token yet or if you've lost it, follow these steps to reset it:
1. Go to [Discord developer portal](https://discord.com/developers/applications)
2. Open your Application's settings
@@ -263,14 +304,10 @@ Prerequisite step: Navigate to [discord.com](https://discord.com) and login.
5. Click **Yes, do it!** and authenticate to confirm
> **Tip**:
-> As the token is only shown once, make sure to copy it and store it in a safe place. If you lose it, you will have to reset the token again.
+> As the token is only shown once, make sure to store it in a safe place. If you lose it, you will have to reset the token again.
> **Warning**:
->
-> Your bot needs to have **Message Content Intent** enabled for it to be able to read messages!
-
-
-
+> Resetting the token will invalidate the old one. Any integrations relying on the old token will cease to function until they are updated.

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 6d5627d8..5bea0629 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -85,7 +85,7 @@ jobs:
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: Upload coverage
- uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
+ uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
@@ -204,7 +204,7 @@ jobs:
steps:
- name: Download artifacts
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ matrix.asset }}.${{ matrix.rid }}
path: ${{ matrix.app }}/
diff --git a/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj b/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj
index 9179c265..d198202c 100644
--- a/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj
+++ b/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj
@@ -11,15 +11,15 @@
-
+
-
-
-
+
+
+
diff --git a/DiscordChatExporter.Cli/Commands/GuideCommand.cs b/DiscordChatExporter.Cli/Commands/GuideCommand.cs
index 78a1e0f4..e4e7ae7d 100644
--- a/DiscordChatExporter.Cli/Commands/GuideCommand.cs
+++ b/DiscordChatExporter.Cli/Commands/GuideCommand.cs
@@ -33,7 +33,10 @@ public class GuideCommand : ICommand
// Bot token
using (console.WithForegroundColor(ConsoleColor.White))
console.Output.WriteLine("To get the token for your bot:");
-
+ console.Output.WriteLine(
+ " If the token wasn't saved during bot creation, generate a new one"
+ );
+ console.Output.WriteLine(" * Integrations using the previous token will stop working until updated");
console.Output.WriteLine(" 1. Go to Discord developer portal");
console.Output.WriteLine(" 2. Open your application's settings");
console.Output.WriteLine(" 3. Navigate to the Bot section on the left");
diff --git a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj
index 81156987..9f41ede4 100644
--- a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj
+++ b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj
@@ -1,4 +1,4 @@
-
+
Exe
@@ -12,7 +12,7 @@
-
+
diff --git a/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj
index b27406ca..65957f4b 100644
--- a/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj
+++ b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj
@@ -1,7 +1,7 @@
-
+
diff --git a/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj b/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj
index ce0cef53..fbb92fff 100644
--- a/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj
+++ b/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj
@@ -15,9 +15,9 @@
-
-
-
+
+
+
@@ -26,7 +26,7 @@
-
+
diff --git a/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml b/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml
index c5a5c849..90178425 100644
--- a/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml
+++ b/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml
@@ -332,6 +332,12 @@
Text="To get the token for your bot:" />
+
+
+
+
+
+
diff --git a/DiscordChatExporter.Gui/Views/MainView.axaml b/DiscordChatExporter.Gui/Views/MainView.axaml
index c93a0aee..f68e3dd6 100644
--- a/DiscordChatExporter.Gui/Views/MainView.axaml
+++ b/DiscordChatExporter.Gui/Views/MainView.axaml
@@ -7,7 +7,7 @@
xmlns:viewModels="clr-namespace:DiscordChatExporter.Gui.ViewModels"
Title="{Binding Title}"
Width="625"
- Height="625"
+ Height="665"
MinWidth="600"
MinHeight="400"
x:DataType="viewModels:MainViewModel"