DiscordChatExporter/DiscordChatExporter.Cli/Commands/GuideCommand.cs

77 lines
3.2 KiB
C#
Raw Normal View History

using System;
using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using CliFx.Infrastructure;
2021-12-08 16:50:21 -05:00
namespace DiscordChatExporter.Cli.Commands;
[Command("guide", Description = "Explains how to obtain the token, server or channel ID.")]
2021-12-08 16:50:21 -05:00
public class GuideCommand : ICommand
{
2021-12-08 16:50:21 -05:00
public ValueTask ExecuteAsync(IConsole console)
{
2021-12-08 16:50:21 -05:00
// User token
using (console.WithForegroundColor(ConsoleColor.White))
2023-12-28 16:56:19 -05:00
console.Output.WriteLine("To get the token for your personal account:");
2023-12-28 17:08:16 -05:00
console.Output.WriteLine(
" * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!"
);
2022-01-25 18:11:22 -05:00
console.Output.WriteLine(" 1. Open Discord in your web browser and login");
2022-09-02 06:29:56 -04:00
console.Output.WriteLine(" 2. Open any server or direct message channel");
console.Output.WriteLine(" 3. Press Ctrl+Shift+I to show developer tools");
console.Output.WriteLine(" 4. Navigate to the Network tab");
console.Output.WriteLine(" 5. Press Ctrl+R to reload");
2023-02-06 08:39:51 -05:00
console.Output.WriteLine(" 6. Switch between random channels to trigger network requests");
2023-11-19 15:51:56 -05:00
console.Output.WriteLine(" 7. Search for a request that starts with \"messages\"");
2023-02-06 08:39:51 -05:00
console.Output.WriteLine(" 8. Select the Headers tab on the right");
console.Output.WriteLine(" 9. Scroll down to the Request Headers section");
console.Output.WriteLine(" 10. Copy the value of the \"authorization\" header");
2021-12-08 16:50:21 -05:00
console.Output.WriteLine();
2021-12-08 16:50:21 -05:00
// Bot token
using (console.WithForegroundColor(ConsoleColor.White))
2023-12-28 16:56:19 -05:00
console.Output.WriteLine("To get the token for your bot:");
2021-12-08 16:50:21 -05:00
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");
console.Output.WriteLine(" 4. Under Token click Copy");
2023-12-28 17:08:16 -05:00
console.Output.WriteLine(
" * Your bot needs to have the Message Content Intent enabled to read messages"
);
2021-12-08 16:50:21 -05:00
console.Output.WriteLine();
2021-12-08 16:50:21 -05:00
// Guild or channel ID
using (console.WithForegroundColor(ConsoleColor.White))
console.Output.WriteLine("To get the ID of a server or a channel:");
2021-12-08 16:50:21 -05:00
console.Output.WriteLine(" 1. Open Discord");
console.Output.WriteLine(" 2. Open Settings");
console.Output.WriteLine(" 3. Go to Advanced section");
2021-12-08 16:50:21 -05:00
console.Output.WriteLine(" 4. Enable Developer Mode");
2023-12-28 17:08:16 -05:00
console.Output.WriteLine(
" 5. Right-click on the desired server or channel and click Copy Server ID or Copy Channel ID"
);
2021-12-08 16:50:21 -05:00
console.Output.WriteLine();
// Docs link
2021-12-08 16:50:21 -05:00
using (console.WithForegroundColor(ConsoleColor.White))
2023-12-28 16:56:19 -05:00
{
2023-12-28 17:08:16 -05:00
console.Output.WriteLine(
"If you have questions or issues, please refer to the documentation:"
);
2023-12-28 16:56:19 -05:00
}
2021-12-08 16:50:21 -05:00
using (console.WithForegroundColor(ConsoleColor.DarkCyan))
2023-12-28 16:56:19 -05:00
{
2023-12-28 17:08:16 -05:00
console.Output.WriteLine(
"https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs"
);
2023-12-28 16:56:19 -05:00
}
2021-12-08 16:50:21 -05:00
return default;
}
2023-08-22 14:17:19 -04:00
}