mirror of
https://github.com/Stone-Red-Code/DiscordCLI.git
synced 2026-09-04 09:05:59 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
393a2c18fa | ||
|
|
361859d2bc | ||
|
|
5e6324b87a | ||
|
|
881299c2d2 | ||
|
|
4231256bfe | ||
|
|
5bf354a22a | ||
|
|
c7e4e89e17 | ||
|
|
6186779115 | ||
|
|
49d62348c8 | ||
|
|
db75f856ff | ||
|
|
3d8d1d4709 | ||
|
|
a1609916c2 | ||
|
|
d162cc0056 | ||
|
|
58f3788a3b | ||
|
|
4a2a3c78c7 | ||
|
|
c63a480fe5 | ||
|
|
5324867113 | ||
|
|
539293226f | ||
|
|
c2471f518f | ||
|
|
fea36aa54c | ||
|
|
9f62187f5a | ||
|
|
45d5b51bab | ||
|
|
f5ef434bc4 | ||
|
|
4921d73ce0 | ||
|
|
1b123e3b3a | ||
|
|
6289f17dfa | ||
|
|
7a731cc62c | ||
|
|
5a09767dbc | ||
|
|
f900292d86 | ||
|
|
95d3c4e476 | ||
|
|
fb55a909f0 | ||
|
|
b758cdab49 | ||
|
|
e9cde21189 | ||
|
|
d518f79263 | ||
|
|
7fbfd85ff4 | ||
|
|
eba0d62fa7 | ||
|
|
a6beab85bb | ||
|
|
16cee9413b | ||
|
|
2265b044cc | ||
|
|
d9143457a7 | ||
|
|
35db02685b | ||
|
|
af721731ea | ||
|
|
652c81defa | ||
|
|
07ff5a6d4a | ||
|
|
57215db498 | ||
|
|
76845b9ae0 | ||
|
|
31b4f9cc44 | ||
|
|
524ed14b1f | ||
|
|
8d93a9de2c |
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots/Videos**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
+365
-1
@@ -1 +1,365 @@
|
||||
*.txt
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# DiscordCLI-specific files
|
||||
token.txt
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
Binary file not shown.
@@ -1,187 +0,0 @@
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus;
|
||||
using Stone_Red_Utilities.ColorConsole;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DiscordCLI
|
||||
{
|
||||
internal class Commands
|
||||
{
|
||||
private readonly DiscordClient client;
|
||||
|
||||
private readonly OutputManager outputManager;
|
||||
|
||||
public Commands(DiscordClient dicordClient, OutputManager outputMan)
|
||||
{
|
||||
client = dicordClient;
|
||||
outputManager = outputMan;
|
||||
}
|
||||
|
||||
protected async Task ListGuilds(string args)
|
||||
{
|
||||
int index = 1;
|
||||
foreach (DiscordGuild guild in client.Guilds.Values)
|
||||
{
|
||||
Console.WriteLine($"{index}. {guild.Name}");
|
||||
index++;
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected async Task ListDms(string args)
|
||||
{
|
||||
int index = 1;
|
||||
foreach (DiscordDmChannel dmChannel in client.PrivateChannels)
|
||||
{
|
||||
Console.WriteLine($"{index}. {string.Join(", ", dmChannel.Recipients.Select(x => x.Username))}");
|
||||
index++;
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected async Task ListGuildChannels(string args)
|
||||
{
|
||||
IReadOnlyCollection<DiscordChannel> textChannels;
|
||||
DiscordGuild guild;
|
||||
|
||||
if (args != null)
|
||||
{
|
||||
if (int.TryParse(args, out int ind))
|
||||
{
|
||||
guild = client.Guilds?.Values.ElementAtOrDefault(ind - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
guild = client.Guilds?.FirstOrDefault(x => x.Value.Name == args).Value;
|
||||
}
|
||||
GlobalInformation.currentTextChannel = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
guild = GlobalInformation.currentGuild;
|
||||
}
|
||||
|
||||
if (guild is null)
|
||||
{
|
||||
ConsoleExt.WriteLine("Guild not found!", ConsoleColor.Red);
|
||||
GlobalInformation.currentTextChannel = null;
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalInformation.currentGuild = guild;
|
||||
textChannels = guild.Channels;
|
||||
|
||||
int index = 1;
|
||||
foreach (DiscordChannel channel in textChannels)
|
||||
{
|
||||
switch (channel.Type)
|
||||
{
|
||||
case ChannelType.Category:
|
||||
//Console.WriteLine($"[{channel.Name}]");
|
||||
break;
|
||||
|
||||
case ChannelType.Text:
|
||||
Console.WriteLine($" {index}. {channel.Name}");
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected async Task EnterChannel(string args)
|
||||
{
|
||||
DiscordChannel textChannel;
|
||||
|
||||
if (GlobalInformation.currentGuild is null)
|
||||
{
|
||||
ConsoleExt.WriteLine("You are not in a guild!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
if (int.TryParse(args, out int ind))
|
||||
{
|
||||
textChannel = GlobalInformation.currentGuild?.Channels.Where(x => x.Type == ChannelType.Text).ElementAtOrDefault(ind - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
textChannel = GlobalInformation.currentGuild?.Channels.Where(x => x.Type == ChannelType.Text).FirstOrDefault(x => x.Name == args);
|
||||
}
|
||||
|
||||
GlobalInformation.currentTextChannel = textChannel;
|
||||
|
||||
if (textChannel is null)
|
||||
{
|
||||
ConsoleExt.WriteLine("Channel not found!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (DiscordMessage message in (textChannel.GetMessagesAsync(10).Result).Reverse())
|
||||
{
|
||||
await outputManager.WriteMessage(message, textChannel, GlobalInformation.currentGuild, false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ConsoleExt.WriteLine(ex.Message, ConsoleColor.Red);
|
||||
GlobalInformation.currentTextChannel = null;
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected async Task EnterDmChannel(string args)
|
||||
{
|
||||
DiscordDmChannel dmChannel;
|
||||
|
||||
GlobalInformation.currentGuild = null;
|
||||
|
||||
if (int.TryParse(args, out int ind))
|
||||
{
|
||||
dmChannel = client.PrivateChannels.ElementAtOrDefault(ind - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmChannel = client.PrivateChannels.FirstOrDefault(x => x.Name == args);
|
||||
}
|
||||
|
||||
GlobalInformation.currentTextChannel = dmChannel;
|
||||
|
||||
if (dmChannel is null)
|
||||
{
|
||||
ConsoleExt.WriteLine("Channel not found!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (DiscordMessage message in (await dmChannel.GetMessagesAsync(10)).Reverse())
|
||||
{
|
||||
await outputManager.WriteMessage(message, dmChannel, GlobalInformation.currentGuild, false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ConsoleExt.WriteLine(ex, ConsoleColor.Red);
|
||||
GlobalInformation.currentTextChannel = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DeleteToken(string args)
|
||||
{
|
||||
File.Delete(Program.tokenPath);
|
||||
Environment.Exit(0);
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using DSharpPlus;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using DSharpPlus.Entities;
|
||||
using System.Linq;
|
||||
|
||||
namespace DiscordCLI
|
||||
{
|
||||
internal class InputManager
|
||||
{
|
||||
private readonly CommandsManager commandsManager;
|
||||
private readonly DiscordClient client;
|
||||
public const string prefix = ">";
|
||||
public string Input { get; private set; } = string.Empty;
|
||||
|
||||
public InputManager(DiscordClient dicordClient, CommandsManager commandsMan)
|
||||
{
|
||||
client = dicordClient;
|
||||
commandsManager = commandsMan;
|
||||
}
|
||||
|
||||
public async Task ReadInput()
|
||||
{
|
||||
bool exit = false;
|
||||
bool printOverride = false;
|
||||
string lastInput = prefix;
|
||||
while (!exit)
|
||||
{
|
||||
DiscordDmChannel dmChannel = GlobalInformation.currentTextChannel as DiscordDmChannel;
|
||||
string infoString = $"\r[{client.CurrentUser.Username}#{client.CurrentUser.Discriminator}] [{(dmChannel is null ? GlobalInformation.currentGuild?.Name : "DMs")}/{(dmChannel is null ? GlobalInformation.currentTextChannel?.Name : string.Join(", ", dmChannel.Recipients.Select(x => x.Username)))}] ==> ";
|
||||
if (lastInput.StartsWith(prefix) || printOverride)
|
||||
Console.Write(Environment.NewLine + infoString);
|
||||
|
||||
printOverride = false;
|
||||
|
||||
ConsoleKeyInfo keyInfo;
|
||||
do
|
||||
{
|
||||
keyInfo = Console.ReadKey(true);
|
||||
if (!char.IsControl(keyInfo.KeyChar))
|
||||
Input += keyInfo.KeyChar.ToString();
|
||||
|
||||
if (keyInfo.Key == ConsoleKey.Backspace && Input.Length > 0)
|
||||
{
|
||||
Input = Input.Remove(Input.Length - 1);
|
||||
}
|
||||
|
||||
Console.Write(keyInfo.KeyChar);
|
||||
if (keyInfo.Key == ConsoleKey.Backspace)
|
||||
Console.Write(" ");
|
||||
|
||||
Console.CursorLeft = infoString.Length + Input.Length - 1;
|
||||
} while (keyInfo.Key != ConsoleKey.Enter);
|
||||
|
||||
if (GlobalInformation.currentTextChannel == null && !Input.StartsWith(prefix))
|
||||
Input = prefix + Input;
|
||||
|
||||
lastInput = new string(Input);
|
||||
Input = string.Empty;
|
||||
|
||||
(exit, printOverride) = await commandsManager.CheckCommand(lastInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
using DSharpPlus;
|
||||
using Stone_Red_Utilities.ColorConsole;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
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()
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
string token = string.Empty;
|
||||
if (File.Exists(tokenPath))
|
||||
token = File.ReadAllText(tokenPath);
|
||||
|
||||
tokenInput:
|
||||
while (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
Console.Write("Enter auth token: ");
|
||||
token = Console.ReadLine();
|
||||
}
|
||||
|
||||
File.WriteAllText(tokenPath, token);
|
||||
|
||||
try
|
||||
{
|
||||
client = new DiscordClient(new DiscordConfiguration()
|
||||
{
|
||||
Token = token,
|
||||
TokenType = TokenType.User,
|
||||
});
|
||||
|
||||
client.MessageCreated += Client_MessageCreated;
|
||||
|
||||
await client.ConnectAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ConsoleExt.WriteLine(ex, ConsoleColor.Red);
|
||||
|
||||
if (ex.Message.Contains("Authentication failed"))
|
||||
{
|
||||
File.Delete(tokenPath);
|
||||
token = string.Empty;
|
||||
goto tokenInput;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
outputManager = new OutputManager(client);
|
||||
commandsManager = new CommandsManager(client, outputManager);
|
||||
inputManager = new InputManager(client, commandsManager);
|
||||
outputManager.InputManager = inputManager;
|
||||
|
||||
await inputManager.ReadInput();
|
||||
}
|
||||
|
||||
private async Task Client_MessageCreated(DSharpPlus.EventArgs.MessageCreateEventArgs e)
|
||||
{
|
||||
await outputManager.WriteMessage(e.Message, e.Channel, e.Guild);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +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">
|
||||
</Project>
|
||||
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.
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.
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "netcoreapp3.1",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "3.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
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.
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.
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.
File diff suppressed because it is too large
Load Diff
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.
@@ -1 +0,0 @@
|
||||
b19e6f37bddcbdb1df945fddaf2581ec8ab2932c
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
d74c436d6f045a94c6aefe230b53cf4fbca29cc5
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
3e2c7be251ce3e62a6541dac29e1895e802a69f2
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
|
||||
@@ -1 +0,0 @@
|
||||
b19e6f37bddcbdb1df945fddaf2581ec8ab2932c
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
bb7f791519035a2baddccc4d9ea552ec90305859
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
e299abbf0e74657c0b5bb8ef0a778b4df7cd199f
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
8dbf5d9b5cf6fb65f2290f681f68bfa7a21560cd
|
||||
@@ -1,8 +0,0 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net5.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.PublishSingleFile =
|
||||
build_property.IncludeAllContentForSelfExtract =
|
||||
build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows
|
||||
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.
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]
|
||||
@@ -1 +0,0 @@
|
||||
8dbf5d9b5cf6fb65f2290f681f68bfa7a21560cd
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
94d569a53a5ac292d10f2db736ac10f01f735125
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
70e9524befa3e92045c7c316dc8b56aab9375e23
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]
|
||||
@@ -1 +0,0 @@
|
||||
8dbf5d9b5cf6fb65f2290f681f68bfa7a21560cd
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user