mirror of
https://github.com/Stone-Red-Code/DiscordCLI.git
synced 2026-09-04 09:05:59 +02:00
Merge branch 'develop' into main
This commit is contained in:
Binary file not shown.
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net5.0\publish\Linux-x64</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<History>True|2021-05-27T05:47:04.1968183Z;True|2021-05-27T07:46:41.8745649+02:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net5.0\publish\Windows</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"additionalProbingPaths": [
|
||||
"C:\\Users\\David\\.dotnet\\store\\|arch|\\|tfm|",
|
||||
"C:\\Users\\David\\.nuget\\packages",
|
||||
"C:\\Microsoft\\Xamarin\\NuGet"
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net5.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net5.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
d74c436d6f045a94c6aefe230b53cf4fbca29cc5
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
3e2c7be251ce3e62a6541dac29e1895e802a69f2
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
b19e6f37bddcbdb1df945fddaf2581ec8ab2932c
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
6b3b4647b7644f9b16fb8ec3b15a9fe904531b35
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
3e2c7be251ce3e62a6541dac29e1895e802a69f2
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
8dbf5d9b5cf6fb65f2290f681f68bfa7a21560cd
|
||||
@@ -1,7 +1,9 @@
|
||||
# DiscordCLI
|
||||
|
||||
> Use Discord in the terminal
|
||||
|
||||
## Warning
|
||||
|
||||
**Use this software at your own risk!**\
|
||||
This isn't directly a selfbot, but Discord may count it as User account automation and this is against their TOS.\
|
||||
I guess everything should be fine as long as you don't behave conspicuously but still proceed with caution!\
|
||||
@@ -9,44 +11,73 @@ Currently there are no known cases where a user got banned for using this Discor
|
||||
Don't blame me if you get banned!\
|
||||
I will update the above if anything changes!
|
||||
|
||||
## Download
|
||||
Releases: https://github.com/Stone-Red-Code/DiscordCLI/releases
|
||||
|
||||
## Usage
|
||||
1. <a href="https://github.com/Stone-Red-Code/DiscordCLI/releases">Download</a> one of the releases
|
||||
|
||||
1. [Download]("https://github.com/Stone-Red-Code/DiscordCLI/releases
|
||||
) one of the releases
|
||||
2. Execute the `DiscordCLI` file
|
||||
3. Enter your <a href="https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs#how-to-get-a-user-token">User Token</a>
|
||||
3. Enter your [User Token](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs#how-to-get-a-user-token">)
|
||||
4. Enter one of the commands below
|
||||
|
||||
## Commands
|
||||
|
||||
### help
|
||||
- lists all commands
|
||||
|
||||
- lists all commands
|
||||
|
||||
### exit
|
||||
- exits application
|
||||
|
||||
- exits application
|
||||
|
||||
### logout
|
||||
- deletes auth token and exits application
|
||||
|
||||
- deletes auth token and exits application
|
||||
|
||||
### clear
|
||||
|
||||
- clears the console
|
||||
|
||||
### guilds
|
||||
- lists all guilds you are in
|
||||
|
||||
- lists all guilds you are in
|
||||
|
||||
### dms
|
||||
- lists all private channels
|
||||
|
||||
- lists all private channels
|
||||
|
||||
### channels
|
||||
- lists all channels of guild
|
||||
- args:<guild name/index>
|
||||
|
||||
- lists all channels of guild
|
||||
|
||||
- args: \<guild name/index>
|
||||
|
||||
### enterg
|
||||
- enter guild
|
||||
- args:<guild name/index>
|
||||
|
||||
- enter guild
|
||||
- args: \<guild name/index>
|
||||
|
||||
### enterc
|
||||
- enter channel
|
||||
- args:<channel name/index>
|
||||
|
||||
- enter channel
|
||||
- args: \<channel name/index>
|
||||
|
||||
### enterd
|
||||
- enter DM channel
|
||||
- args: <channel name/index>
|
||||
|
||||
- enter DM channel
|
||||
- args: \<channel name/index>
|
||||
|
||||
### userinfo
|
||||
|
||||
- gets information about a user
|
||||
- args: \<user name>
|
||||
|
||||
## Limitations
|
||||
|
||||
DiscordCLI doesn't support everything the official Discord app does.
|
||||
If you find a missing feature in DiscordCLI that is not listed below please tell me or create a pull request and update the list below.
|
||||
|
||||
### Current limitation:
|
||||
### Current limitation
|
||||
|
||||
- No voice support
|
||||
- Mentions can't be created easily
|
||||
- You can't add/remove guilds
|
||||
@@ -54,4 +85,3 @@ If you find a missing feature in DiscordCLI that is not listed below please tell
|
||||
- Discord online status not updating
|
||||
|
||||
And probably more.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus;
|
||||
using Stone_Red_Utilities.ColorConsole;
|
||||
using Stone_Red_Utilities.ConsoleExtentions;
|
||||
using Stone_Red_Utilities.StringExtentions;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System;
|
||||
@@ -87,7 +87,7 @@ namespace DiscordCLI
|
||||
break;
|
||||
|
||||
case ChannelType.Text:
|
||||
Console.WriteLine($" {index}. {channel.Name}");
|
||||
Console.WriteLine($"{index}. {channel.Name}");
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
@@ -183,5 +183,58 @@ namespace DiscordCLI
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected async Task UserInfo(string userName)
|
||||
{
|
||||
if (GlobalInformation.currentGuild is null)
|
||||
{
|
||||
ConsoleExt.WriteLine("You are not in a guild!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
if (userName is null)
|
||||
{
|
||||
ConsoleExt.WriteLine("User not found!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
DiscordUser discordUser = GlobalInformation.currentGuild?.Members?.FirstOrDefault(user => user.Username.EqualsIgnoreSpacesAndCase(userName));
|
||||
|
||||
if (discordUser is null)
|
||||
{
|
||||
discordUser = GlobalInformation.currentGuild?.Members?.FirstOrDefault(user => $"{user.Username}#{user.Discriminator}".EqualsIgnoreSpacesAndCase(userName));
|
||||
}
|
||||
|
||||
if (discordUser is null)
|
||||
{
|
||||
discordUser = GlobalInformation.currentGuild?.Members?.FirstOrDefault(user => $"{user.Nickname}".EqualsIgnoreSpacesAndCase(userName));
|
||||
}
|
||||
|
||||
if (discordUser is not null)
|
||||
{
|
||||
string status = discordUser.Presence?.Status.ToString();
|
||||
status ??= "N/A";
|
||||
|
||||
string infoString =
|
||||
$"Username: {discordUser.Username}#{discordUser.Discriminator}" + Environment.NewLine +
|
||||
$"Status: {status}" + Environment.NewLine +
|
||||
$"Created at: {discordUser.CreationTimestamp}" + Environment.NewLine +
|
||||
$"ID: {discordUser.Id}" + Environment.NewLine +
|
||||
$"Bot: {discordUser.IsBot}";
|
||||
Console.WriteLine(infoString);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleExt.WriteLine("User not found!", ConsoleColor.Red);
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected async Task Clear(string args)
|
||||
{
|
||||
Console.Clear();
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using DSharpPlus;
|
||||
using Stone_Red_Utilities.ColorConsole;
|
||||
using Stone_Red_Utilities.ConsoleExtentions;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
@@ -23,12 +23,14 @@ namespace DiscordCLI
|
||||
{
|
||||
{ "exit", ("exits application", null) },
|
||||
{ "logout", ("deletes auth token and exits application", DeleteToken) },
|
||||
{ "clear", ("clears the console", Clear) },
|
||||
{ "guilds", ("lists all guilds you are in", ListGuilds) },
|
||||
{ "dms", ("lists all private channels", ListDms) },
|
||||
{ "channels", ("lists all channels of guild args:<guild name/index>", ListGuildChannels) },
|
||||
{ "enterg", ("enter guild args:<guild name/index>", ListGuildChannels) },
|
||||
{ "enterc", ("enter channel args:<channel name/index>", EnterChannel) },
|
||||
{ "enterd", ("enter DM channel args:<channel name/index>", EnterDmChannel) },
|
||||
{ "userinfo", ("gets information about a user args:<username>", UserInfo) },
|
||||
};
|
||||
|
||||
Timer cooldownTimer = new Timer(1000);
|
||||
@@ -3,11 +3,19 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AssemblyVersion>0.0.4.0</AssemblyVersion>
|
||||
<FileVersion>0.0.4.0</FileVersion>
|
||||
<Version>0.0.4.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlwaysUpToDate" Version="1.0.0.3" />
|
||||
<PackageReference Include="ColorMineStandard" Version="1.0.0" />
|
||||
<PackageReference Include="DSharpPlus" Version="3.2.3" />
|
||||
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.0.2" />
|
||||
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\PublishProfiles\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>C:\Users\David\Google Drive\Programmieren\DiscordCLI\DiscordCLI\Properties\PublishProfiles\Windows.pubxml</_LastSelectedProfileId>
|
||||
<_LastSelectedProfileId>C:\Users\David\Google Drive\Programmieren\DiscordCLI\src\DiscordCLI\Properties\PublishProfiles\DiscordCLI.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using System;
|
||||
using DSharpPlus.Entities;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscordCLI
|
||||
{
|
||||
@@ -10,6 +11,7 @@ namespace DiscordCLI
|
||||
{
|
||||
private readonly CommandsManager commandsManager;
|
||||
private readonly DiscordClient client;
|
||||
private readonly List<string> previousInputs = new List<string>();
|
||||
public const string prefix = ">";
|
||||
public string Input { get; private set; } = string.Empty;
|
||||
|
||||
@@ -21,6 +23,7 @@ namespace DiscordCLI
|
||||
|
||||
public async Task ReadInput()
|
||||
{
|
||||
int inputListIndex = 0;
|
||||
bool exit = false;
|
||||
bool printOverride = false;
|
||||
string lastInput = prefix;
|
||||
@@ -44,6 +47,26 @@ namespace DiscordCLI
|
||||
{
|
||||
Input = Input.Remove(Input.Length - 1);
|
||||
}
|
||||
else if (keyInfo.Key == ConsoleKey.UpArrow)
|
||||
{
|
||||
if (previousInputs.Count > 0)
|
||||
Input = previousInputs[previousInputs.Count - inputListIndex - 1];
|
||||
|
||||
if (inputListIndex < previousInputs.Count - 1)
|
||||
inputListIndex++;
|
||||
Console.CursorLeft = infoString.Length - 1;
|
||||
Console.Write(Input + new string(' ', Console.WindowWidth - infoString.Length - 1));
|
||||
}
|
||||
else if (keyInfo.Key == ConsoleKey.DownArrow)
|
||||
{
|
||||
if (previousInputs.Count > 0)
|
||||
Input = previousInputs[previousInputs.Count - inputListIndex - 1];
|
||||
|
||||
if (inputListIndex > 0)
|
||||
inputListIndex--;
|
||||
Console.CursorLeft = infoString.Length - 1;
|
||||
Console.Write(Input + new string(' ', Console.WindowWidth - infoString.Length - 1));
|
||||
}
|
||||
|
||||
Console.Write(keyInfo.KeyChar);
|
||||
if (keyInfo.Key == ConsoleKey.Backspace)
|
||||
@@ -53,8 +76,17 @@ namespace DiscordCLI
|
||||
} while (keyInfo.Key != ConsoleKey.Enter);
|
||||
|
||||
if (GlobalInformation.currentTextChannel == null && !Input.StartsWith(prefix))
|
||||
Input = prefix + Input;
|
||||
{
|
||||
if (previousInputs.Count > 10)
|
||||
previousInputs.RemoveAt(0);
|
||||
|
||||
if (previousInputs.Count == 0 || previousInputs[previousInputs.Count - 1] != Input)
|
||||
previousInputs.Add(new string(Input));
|
||||
|
||||
Input = prefix + Input;
|
||||
}
|
||||
|
||||
inputListIndex = 0;
|
||||
lastInput = new string(Input);
|
||||
Input = string.Empty;
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
using ColorMine.ColorSpaces;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus;
|
||||
using Stone_Red_Utilities.ColorConsole;
|
||||
using Stone_Red_Utilities.ConsoleExtentions;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscordCLI
|
||||
{
|
||||
@@ -66,11 +67,13 @@ namespace DiscordCLI
|
||||
}
|
||||
|
||||
if (embed.Fields is not null)
|
||||
{
|
||||
foreach (DiscordEmbedField field in embed.Fields)
|
||||
{
|
||||
WriteTop(">>> ", Color.FromArgb(embed.Color.Value), message, true, false);
|
||||
WriteTop($"{field.Name}{Environment.NewLine}{field.Value}", Color.White, message, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -99,8 +102,8 @@ namespace DiscordCLI
|
||||
if (removeText)
|
||||
Console.Write('\r' + new string(' ', Console.WindowWidth) + '\r');
|
||||
|
||||
string[] words = message.Split(' ');
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
List<string> words = message.Replace("\n", " %<newLine>%").Split(' ').ToList();
|
||||
for (int i = 0; i < words.Count; i++)
|
||||
{
|
||||
ConsoleColor mentionColor = ConsoleColor.Black;
|
||||
|
||||
@@ -109,6 +112,29 @@ namespace DiscordCLI
|
||||
mentionColor = ConsoleColor.DarkCyan;
|
||||
}
|
||||
|
||||
if (words[i].Contains("<") && words[i].Contains(">") && !(words[i].StartsWith("<") && words[i].EndsWith(">")))
|
||||
{
|
||||
int index1 = words[i].IndexOf("<");
|
||||
int index2 = words[i].IndexOf(">");
|
||||
if (index1 < index2)
|
||||
{
|
||||
string part1 = words[i].Substring(0, index1);
|
||||
string part2 = words[i].Substring(index1, index2 - index1 + 1);
|
||||
string part3 = words[i].Substring(index2 + 1, words[i].Length - index2 - 1);
|
||||
|
||||
words[i] = part2;
|
||||
if (!string.IsNullOrEmpty(part1))
|
||||
{
|
||||
words.Insert(i, part1);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(part3))
|
||||
{
|
||||
words.Insert(i + (string.IsNullOrEmpty(part1) ? 1 : 2), part3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (DiscordUser user in discordMessage.MentionedUsers)
|
||||
{
|
||||
if (user?.Mention is not null)
|
||||
@@ -122,7 +148,16 @@ namespace DiscordCLI
|
||||
else
|
||||
{
|
||||
if (words[i].Contains("<@") && words[i].Contains('>'))
|
||||
mentionColor = ConsoleColor.Blue;
|
||||
{
|
||||
if (ulong.TryParse(words[i].Replace("!", string.Empty).Replace("<@", string.Empty).Replace(">", string.Empty), out ulong id))
|
||||
{
|
||||
DiscordUser discordUser = client.GetUserAsync(id).Result;
|
||||
Console.WriteLine(discordUser is null);
|
||||
|
||||
words[i] = words[i].Replace("<@!", "<@").Replace(discordUser.Mention, $"@{discordUser.Username}#{discordUser.Discriminator}");
|
||||
mentionColor = ConsoleColor.Blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +184,7 @@ namespace DiscordCLI
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleExt.Write(words[i] + " ", mentionColor == ConsoleColor.Black ? consoleColor : mentionColor);
|
||||
ConsoleExt.Write(words[i].Replace("%<newLine>%", "\n") + " ", mentionColor == ConsoleColor.Black ? consoleColor : mentionColor);
|
||||
}
|
||||
|
||||
ConsoleExt.Write(info, ConsoleColor.DarkGray);
|
||||
@@ -1,27 +1,47 @@
|
||||
using DSharpPlus;
|
||||
using Stone_Red_Utilities.ColorConsole;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using DSharpPlus.Exceptions;
|
||||
using Stone_Red_Utilities.ConsoleExtentions;
|
||||
using System.Reflection;
|
||||
using AlwaysUpToDate;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DiscordCLI
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static void Main() => new Program().MainAsync().GetAwaiter().GetResult();
|
||||
|
||||
private DiscordClient client;
|
||||
private InputManager inputManager;
|
||||
private OutputManager outputManager;
|
||||
private CommandsManager commandsManager;
|
||||
|
||||
public const string tokenPath = "token.txt";
|
||||
|
||||
public async Task MainAsync()
|
||||
private DiscordClient client;
|
||||
private CommandsManager commandsManager;
|
||||
private InputManager inputManager;
|
||||
private OutputManager outputManager;
|
||||
|
||||
#if DEBUG
|
||||
private Updater updater = new Updater(new TimeSpan(0), "https://raw.githubusercontent.com/Stone-Red-Code/DiscordCLI/develop/update/updateInfo.json", "./", true);
|
||||
#else
|
||||
private Updater updater = new Updater(new TimeSpan(0), "https://raw.githubusercontent.com/Stone-Red-Code/DiscordCLI/main/update/updateInfo.json", "./", true);
|
||||
#endif
|
||||
|
||||
public static void Main() => new Program().Setup().GetAwaiter().GetResult();
|
||||
|
||||
private async Task Setup()
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
updater.UpdateAvailible += Updater_UpdateAvailible;
|
||||
updater.NoUpdateAvailible += Updater_NoUpdateAvailible;
|
||||
updater.ProgressChanged += Updater_ProgressChanged;
|
||||
|
||||
updater.Start();
|
||||
await Task.Delay(-1);
|
||||
}
|
||||
|
||||
private async Task Start()
|
||||
{
|
||||
string token = string.Empty;
|
||||
if (File.Exists(tokenPath))
|
||||
token = File.ReadAllText(tokenPath);
|
||||
@@ -46,12 +66,13 @@ namespace DiscordCLI
|
||||
client.MessageCreated += Client_MessageCreated;
|
||||
|
||||
await client.ConnectAsync();
|
||||
ConsoleExt.WriteLine("Welcome to DiscordCLI", ConsoleColor.Green);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ConsoleExt.WriteLine(ex, ConsoleColor.Red);
|
||||
ConsoleExt.WriteLine(ex.Message, ConsoleColor.Red);
|
||||
|
||||
if (ex.Message.Contains("Authentication failed"))
|
||||
if (ex.InnerException is UnauthorizedException)
|
||||
{
|
||||
File.Delete(tokenPath);
|
||||
token = string.Empty;
|
||||
@@ -68,6 +89,23 @@ namespace DiscordCLI
|
||||
await inputManager.ReadInput();
|
||||
}
|
||||
|
||||
private async void Updater_NoUpdateAvailible()
|
||||
{
|
||||
await Start();
|
||||
}
|
||||
|
||||
private void Updater_ProgressChanged(long? totalFileSize, long totalBytesDownloaded, double? progressPercentage)
|
||||
{
|
||||
Console.CursorLeft = 0;
|
||||
ConsoleExt.WriteLine($"Downloading Update: {progressPercentage}% {totalBytesDownloaded}/{totalFileSize}", ConsoleColor.Yellow);
|
||||
}
|
||||
|
||||
private void Updater_UpdateAvailible(string version, string additionalInformation)
|
||||
{
|
||||
Console.WriteLine($"New version avalible! {version}");
|
||||
updater.Update();
|
||||
}
|
||||
|
||||
private async Task Client_MessageCreated(DSharpPlus.EventArgs.MessageCreateEventArgs e)
|
||||
{
|
||||
await outputManager.WriteMessage(e.Message, e.Channel, e.Guild);
|
||||
+1
-1
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net5.0\publish\Linux-arm</PublishDir>
|
||||
<PublishDir>bin\Release\net5.0\publish\DiscordCLI</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+1
-1
@@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<History>True|2021-05-27T05:47:11.2358523Z;</History>
|
||||
<History>True|2021-05-29T16:25:28.6698849Z;True|2021-05-29T17:53:55.7039453+02:00;True|2021-05-29T17:07:22.9610987+02:00;True|2021-05-29T16:21:45.0240481+02:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
+44
-10
@@ -6,16 +6,28 @@
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"DiscordCLI/1.0.0": {
|
||||
"DiscordCLI/0.0.4.0": {
|
||||
"dependencies": {
|
||||
"AlwaysUpToDate": "1.0.0.3",
|
||||
"ColorMineStandard": "1.0.0",
|
||||
"DSharpPlus": "3.2.3",
|
||||
"Stone_Red-C-Sharp-Utilities": "1.0.0.2"
|
||||
"Stone_Red-C-Sharp-Utilities": "1.0.2.1"
|
||||
},
|
||||
"runtime": {
|
||||
"DiscordCLI.dll": {}
|
||||
}
|
||||
},
|
||||
"AlwaysUpToDate/1.0.0.3": {
|
||||
"dependencies": {
|
||||
"System.Text.Json": "5.0.2"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/AlwaysUpToDate.dll": {
|
||||
"assemblyVersion": "1.0.0.3",
|
||||
"fileVersion": "1.0.0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ColorMineStandard/1.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/ColorMineStandard.dll": {
|
||||
@@ -186,11 +198,11 @@
|
||||
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.0.2": {
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.2.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll": {
|
||||
"assemblyVersion": "1.0.0.2",
|
||||
"fileVersion": "1.0.0.2"
|
||||
"assemblyVersion": "1.0.2.1",
|
||||
"fileVersion": "1.0.2.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -903,6 +915,14 @@
|
||||
"System.Text.Encoding": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Text.Json/5.0.2": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.0/System.Text.Json.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.521.16609"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Text.RegularExpressions/4.3.0": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.3.0"
|
||||
@@ -993,11 +1013,18 @@
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"DiscordCLI/1.0.0": {
|
||||
"DiscordCLI/0.0.4.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"AlwaysUpToDate/1.0.0.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vJCFkNoEa4cnf4Bck20k0DaPsLk1kgP8uH2B2dbOSpXv+kzVzLAaUsPWO1cm3Yo8bs3Z8JwG3J4xz4AcRzh3yg==",
|
||||
"path": "alwaysuptodate/1.0.0.3",
|
||||
"hashPath": "alwaysuptodate.1.0.0.3.nupkg.sha512"
|
||||
},
|
||||
"ColorMineStandard/1.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -1173,12 +1200,12 @@
|
||||
"path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.2",
|
||||
"hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512"
|
||||
},
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.0.2": {
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.2.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-/oH1XweI6G2VjeXuutq3XhHAPiSpotfPnsRMK0n8BXFOqG85y0AXQGaKiEdhCZZOpLHFrNY8rtLepMgLJrsY9w==",
|
||||
"path": "stone_red-c-sharp-utilities/1.0.0.2",
|
||||
"hashPath": "stone_red-c-sharp-utilities.1.0.0.2.nupkg.sha512"
|
||||
"sha512": "sha512-QzwH0QvsDiBvCJTFroZBhN/pMEIiz0C8TNkQci+pxCbnjfTtVkxAYsgmlshCl5oHFJh7VYDLcGAULcMBARSb+w==",
|
||||
"path": "stone_red-c-sharp-utilities/1.0.2.1",
|
||||
"hashPath": "stone_red-c-sharp-utilities.1.0.2.1.nupkg.sha512"
|
||||
},
|
||||
"System.AppContext/4.3.0": {
|
||||
"type": "package",
|
||||
@@ -1614,6 +1641,13 @@
|
||||
"path": "system.text.encoding.extensions/4.3.0",
|
||||
"hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Json/5.0.2": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==",
|
||||
"path": "system.text.json/5.0.2",
|
||||
"hashPath": "system.text.json.5.0.2.nupkg.sha512"
|
||||
},
|
||||
"System.Text.RegularExpressions/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+44
-10
@@ -6,16 +6,28 @@
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"DiscordCLI/1.0.0": {
|
||||
"DiscordCLI/0.0.4.0": {
|
||||
"dependencies": {
|
||||
"AlwaysUpToDate": "1.0.0.3",
|
||||
"ColorMineStandard": "1.0.0",
|
||||
"DSharpPlus": "3.2.3",
|
||||
"Stone_Red-C-Sharp-Utilities": "1.0.0.2"
|
||||
"Stone_Red-C-Sharp-Utilities": "1.0.2.1"
|
||||
},
|
||||
"runtime": {
|
||||
"DiscordCLI.dll": {}
|
||||
}
|
||||
},
|
||||
"AlwaysUpToDate/1.0.0.3": {
|
||||
"dependencies": {
|
||||
"System.Text.Json": "5.0.2"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/AlwaysUpToDate.dll": {
|
||||
"assemblyVersion": "1.0.0.3",
|
||||
"fileVersion": "1.0.0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ColorMineStandard/1.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/ColorMineStandard.dll": {
|
||||
@@ -186,11 +198,11 @@
|
||||
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.0.2": {
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.2.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll": {
|
||||
"assemblyVersion": "1.0.0.2",
|
||||
"fileVersion": "1.0.0.2"
|
||||
"assemblyVersion": "1.0.2.1",
|
||||
"fileVersion": "1.0.2.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -903,6 +915,14 @@
|
||||
"System.Text.Encoding": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Text.Json/5.0.2": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.0/System.Text.Json.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.521.16609"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Text.RegularExpressions/4.3.0": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.3.0"
|
||||
@@ -993,11 +1013,18 @@
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"DiscordCLI/1.0.0": {
|
||||
"DiscordCLI/0.0.4.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"AlwaysUpToDate/1.0.0.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vJCFkNoEa4cnf4Bck20k0DaPsLk1kgP8uH2B2dbOSpXv+kzVzLAaUsPWO1cm3Yo8bs3Z8JwG3J4xz4AcRzh3yg==",
|
||||
"path": "alwaysuptodate/1.0.0.3",
|
||||
"hashPath": "alwaysuptodate.1.0.0.3.nupkg.sha512"
|
||||
},
|
||||
"ColorMineStandard/1.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -1173,12 +1200,12 @@
|
||||
"path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.2",
|
||||
"hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512"
|
||||
},
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.0.2": {
|
||||
"Stone_Red-C-Sharp-Utilities/1.0.2.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-/oH1XweI6G2VjeXuutq3XhHAPiSpotfPnsRMK0n8BXFOqG85y0AXQGaKiEdhCZZOpLHFrNY8rtLepMgLJrsY9w==",
|
||||
"path": "stone_red-c-sharp-utilities/1.0.0.2",
|
||||
"hashPath": "stone_red-c-sharp-utilities.1.0.0.2.nupkg.sha512"
|
||||
"sha512": "sha512-QzwH0QvsDiBvCJTFroZBhN/pMEIiz0C8TNkQci+pxCbnjfTtVkxAYsgmlshCl5oHFJh7VYDLcGAULcMBARSb+w==",
|
||||
"path": "stone_red-c-sharp-utilities/1.0.2.1",
|
||||
"hashPath": "stone_red-c-sharp-utilities.1.0.2.1.nupkg.sha512"
|
||||
},
|
||||
"System.AppContext/4.3.0": {
|
||||
"type": "package",
|
||||
@@ -1614,6 +1641,13 @@
|
||||
"path": "system.text.encoding.extensions/4.3.0",
|
||||
"hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Json/5.0.2": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==",
|
||||
"path": "system.text.json/5.0.2",
|
||||
"hashPath": "system.text.json.5.0.2.nupkg.sha512"
|
||||
},
|
||||
"System.Text.RegularExpressions/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user