diff --git a/.vs/DiscordCLI/DesignTimeBuild/.dtbcache.v2 b/.vs/DiscordCLI/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..2e52c07 Binary files /dev/null and b/.vs/DiscordCLI/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/DiscordCLI/v16/.suo b/.vs/DiscordCLI/v16/.suo index 8ee337a..23e80ed 100644 Binary files a/.vs/DiscordCLI/v16/.suo and b/.vs/DiscordCLI/v16/.suo differ diff --git a/DiscordCLI/Commands.cs b/DiscordCLI/Commands.cs index 3dd6302..651431f 100644 --- a/DiscordCLI/Commands.cs +++ b/DiscordCLI/Commands.cs @@ -1,6 +1,7 @@ using DSharpPlus.Entities; using DSharpPlus; using Stone_Red_Utilities.ColorConsole; +using Stone_Red_Utilities.StringExtentions; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -87,7 +88,7 @@ namespace DiscordCLI break; case ChannelType.Text: - Console.WriteLine($" {index}. {channel.Name}"); + Console.WriteLine($"{index}. {channel.Name}"); index++; break; } @@ -183,5 +184,49 @@ 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 infoString = + $"Username: {discordUser.Username}#{discordUser.Discriminator}" + Environment.NewLine + + $"Status: {discordUser.Presence?.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; + } } } \ No newline at end of file diff --git a/DiscordCLI/CommandsManager.cs b/DiscordCLI/CommandsManager.cs index 24a3b20..424af6a 100644 --- a/DiscordCLI/CommandsManager.cs +++ b/DiscordCLI/CommandsManager.cs @@ -29,6 +29,7 @@ namespace DiscordCLI { "enterg", ("enter guild args:", ListGuildChannels) }, { "enterc", ("enter channel args:", EnterChannel) }, { "enterd", ("enter DM channel args:", EnterDmChannel) }, + { "userinfo", ("gets information about a user:", UserInfo) }, }; Timer cooldownTimer = new Timer(1000); diff --git a/DiscordCLI/OutputManager.cs b/DiscordCLI/OutputManager.cs index d298ac2..b6dc1be 100644 --- a/DiscordCLI/OutputManager.cs +++ b/DiscordCLI/OutputManager.cs @@ -8,6 +8,7 @@ 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 words = message.Replace("\n", " %%").Split(' ').ToList(); + for (int i = 0; i < words.Count; i++) { ConsoleColor mentionColor = ConsoleColor.Black; @@ -109,6 +112,31 @@ 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); + + Debug.WriteLine(words[i] + "/" + i); + Debug.WriteLine(part1 + "/" + part2 + "/" + part3); + 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 +150,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 +186,7 @@ namespace DiscordCLI } } - ConsoleExt.Write(words[i] + " ", mentionColor == ConsoleColor.Black ? consoleColor : mentionColor); + ConsoleExt.Write(words[i].Replace("%%", "\n") + " ", mentionColor == ConsoleColor.Black ? consoleColor : mentionColor); } ConsoleExt.Write(info, ConsoleColor.DarkGray); diff --git a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll index a6c8db1..8a24fe2 100644 Binary files a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll and b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll differ diff --git a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.exe b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.exe index eb9c071..6744740 100644 Binary files a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.exe and b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.exe differ diff --git a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb index d7e4adf..ba57a27 100644 Binary files a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb and b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb differ diff --git a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.runtimeconfig.dev.json b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.runtimeconfig.dev.json index 7edec84..560c599 100644 --- a/DiscordCLI/bin/Debug/net5.0/DiscordCLI.runtimeconfig.dev.json +++ b/DiscordCLI/bin/Debug/net5.0/DiscordCLI.runtimeconfig.dev.json @@ -3,7 +3,8 @@ "additionalProbingPaths": [ "C:\\Users\\David\\.dotnet\\store\\|arch|\\|tfm|", "C:\\Users\\David\\.nuget\\packages", - "C:\\Microsoft\\Xamarin\\NuGet" + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages", + "C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet" ] } } \ No newline at end of file diff --git a/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll b/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll index 0243bd0..4487d43 100644 Binary files a/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll and b/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll differ diff --git a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.assets.cache b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.assets.cache index 2e0a32a..8aba9ea 100644 Binary files a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.assets.cache and b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.assets.cache differ diff --git a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csprojAssemblyReference.cache b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csprojAssemblyReference.cache index fc9f7b3..c582102 100644 Binary files a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csprojAssemblyReference.cache and b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csprojAssemblyReference.cache differ diff --git a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll index a6c8db1..8a24fe2 100644 Binary files a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll and b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll differ diff --git a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb index d7e4adf..ba57a27 100644 Binary files a/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb and b/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb differ diff --git a/DiscordCLI/obj/Debug/net5.0/apphost.exe b/DiscordCLI/obj/Debug/net5.0/apphost.exe index eb9c071..6744740 100644 Binary files a/DiscordCLI/obj/Debug/net5.0/apphost.exe and b/DiscordCLI/obj/Debug/net5.0/apphost.exe differ diff --git a/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll b/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll index 0243bd0..4487d43 100644 Binary files a/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll and b/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll differ diff --git a/DiscordCLI/obj/Release/net5.0/DiscordCLI.csprojAssemblyReference.cache b/DiscordCLI/obj/Release/net5.0/DiscordCLI.csprojAssemblyReference.cache index 4da4158..76939af 100644 Binary files a/DiscordCLI/obj/Release/net5.0/DiscordCLI.csprojAssemblyReference.cache and b/DiscordCLI/obj/Release/net5.0/DiscordCLI.csprojAssemblyReference.cache differ diff --git a/README.md b/README.md index cf96187..61625e6 100644 --- a/README.md +++ b/README.md @@ -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,69 @@ 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. Download 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 User Token +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 + ### 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: + +- lists all channels of guild + + - args: \ + ### enterg - - enter guild - - args: + +- enter guild +- args: \ + ### enterc - - enter channel - - args: + +- enter channel +- args: \ + ### enterd - - enter DM channel - - args: + +- enter DM channel +- args: \ + +### userinfo + +- gets information about a user +- args: \ ## 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 +81,3 @@ If you find a missing feature in DiscordCLI that is not listed below please tell - Discord online status not updating And probably more. -