diff --git a/.idea/.idea.CSharpBot/.idea/.name b/.idea/.idea.CSharpBot/.idea/.name deleted file mode 100644 index d390146..0000000 --- a/.idea/.idea.CSharpBot/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -CSharpBot \ No newline at end of file diff --git a/.idea/.idea.CSharpBot/.idea/.gitignore b/.idea/.idea.Sharpy/.idea/.gitignore similarity index 100% rename from .idea/.idea.CSharpBot/.idea/.gitignore rename to .idea/.idea.Sharpy/.idea/.gitignore diff --git a/.idea/.idea.CSharpBot/.idea/discord.xml b/.idea/.idea.Sharpy/.idea/discord.xml similarity index 100% rename from .idea/.idea.CSharpBot/.idea/discord.xml rename to .idea/.idea.Sharpy/.idea/discord.xml diff --git a/.idea/.idea.CSharpBot/.idea/encodings.xml b/.idea/.idea.Sharpy/.idea/encodings.xml similarity index 100% rename from .idea/.idea.CSharpBot/.idea/encodings.xml rename to .idea/.idea.Sharpy/.idea/encodings.xml diff --git a/.idea/.idea.CSharpBot/.idea/indexLayout.xml b/.idea/.idea.Sharpy/.idea/indexLayout.xml similarity index 100% rename from .idea/.idea.CSharpBot/.idea/indexLayout.xml rename to .idea/.idea.Sharpy/.idea/indexLayout.xml diff --git a/.idea/.idea.CSharpBot/.idea/vcs.xml b/.idea/.idea.Sharpy/.idea/vcs.xml similarity index 100% rename from .idea/.idea.CSharpBot/.idea/vcs.xml rename to .idea/.idea.Sharpy/.idea/vcs.xml diff --git a/CSharpBot.sln b/Sharpy.sln similarity index 81% rename from CSharpBot.sln rename to Sharpy.sln index f60bce3..e1e302e 100644 --- a/CSharpBot.sln +++ b/Sharpy.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBot", "CSharpBot\CSharpBot.csproj", "{57AEE340-B119-49C8-9217-D87250628498}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpy", "Sharpy\Sharpy.csproj", "{57AEE340-B119-49C8-9217-D87250628498}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Sharpy/Commands/Msg/General/Info.cs b/Sharpy/Commands/Msg/General/Info.cs new file mode 100644 index 0000000..a08ec85 --- /dev/null +++ b/Sharpy/Commands/Msg/General/Info.cs @@ -0,0 +1,62 @@ +using System; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using ByteSizeLib; +using DSharpPlus.CommandsNext; +using DSharpPlus.CommandsNext.Attributes; +using DSharpPlus.Entities; +using Hardware.Info; + +namespace Sharpy.Commands.Msg.General +{ + public class Info : BaseCommandModule + { + [Command("info"), Description("Get info about the bot"), Cooldown(5, 5, CooldownBucketType.Global)] + public async Task InfoCommand(CommandContext ctx) + { + var clientMember = from member in ctx.Guild.Members + where member.Value.Id == ctx.Client.CurrentUser.Id + select member.Value; + + var roleColor = clientMember.First().Color; + + var loadingMsg = await ctx.RespondAsync("Loading..."); + + var hardwareInfo = new HardwareInfo(); + hardwareInfo.RefreshCPUList(); + hardwareInfo.RefreshMemoryStatus(); + + var currentRamUsage = + Math.Round( + Convert.ToDecimal(ByteSize + .FromBytes(hardwareInfo.MemoryStatus.TotalPhysical - hardwareInfo.MemoryStatus.AvailablePhysical) + .GibiBytes), 2); + + var totalRamUsage = + Math.Round(Convert.ToDecimal(ByteSize.FromBytes(hardwareInfo.MemoryStatus.TotalPhysical).GibiBytes), 2); + + var embed = new DiscordEmbedBuilder() + .WithAuthor("Sharpy") + .WithColor(roleColor) + .WithDescription(@$"**Library Version**: DSharpPlus Version {ctx.Client.VersionString} +**Bot Version**: {Assembly.GetExecutingAssembly().GetName().Name} Version {Assembly.GetExecutingAssembly().GetName().Version} + +**Bot Stats** +**Servers**: {ctx.Client.Guilds.Count} +**Shards**: {ctx.Client.ShardCount} (Current Shard: {ctx.Client.ShardId}) + +**System Stats** +**OS**: {RuntimeInformation.RuntimeIdentifier} +**CPU**: {hardwareInfo.CpuList.First().Name} (x{hardwareInfo.CpuList.Count}) +**Process RAM Usage**: {Math.Round(Convert.ToDecimal(ByteSize.FromBytes(Process.GetCurrentProcess().WorkingSet64).MebiBytes), 2)}MB +**Total RAM Usage**: {currentRamUsage}GB/{totalRamUsage}GB ({Math.Round(currentRamUsage / totalRamUsage * 100, 2)}%)") + .Build(); + + await loadingMsg.DeleteAsync(); + await ctx.RespondAsync(embed); + } + } +} diff --git a/CSharpBot/Program.cs b/Sharpy/Program.cs similarity index 89% rename from CSharpBot/Program.cs rename to Sharpy/Program.cs index 51adfb5..e31339d 100644 --- a/CSharpBot/Program.cs +++ b/Sharpy/Program.cs @@ -4,10 +4,6 @@ using System.Threading.Tasks; using DSharpPlus; using DSharpPlus.CommandsNext; using DSharpPlus.Entities; -using DSharpPlus.Interactivity.Extensions; -using DSharpPlus.Lavalink; -using DSharpPlus.SlashCommands; -using DSharpPlus.VoiceNext; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -49,12 +45,13 @@ var discord = new DiscordClient(new DiscordConfiguration var services = new ServiceCollection() .BuildServiceProvider(); -/*var slash = discord.UseSlashCommands(); +/* var lavalink = discord.UseLavalink(); var interactivity = discord.UseInteractivity(); -var voice = discord.UseVoiceNext();*/ +var voice = discord.UseVoiceNext(); +*/ -// register commands +// Register Msg Commands var commands = discord.UseCommandsNext(new CommandsNextConfiguration { CaseSensitive = false, @@ -70,5 +67,11 @@ var commands = discord.UseCommandsNext(new CommandsNextConfiguration commands.RegisterCommands(Assembly.GetExecutingAssembly()); +/*// Register Slash Commands +var slash = discord.UseSlashCommands(new SlashCommandsConfiguration +{ + Services = services +});*/ + await discord.ConnectAsync(new DiscordActivity("With DSharpPlus")); await Task.Delay(-1); diff --git a/CSharpBot/Properties/PublishProfiles/publish-linux-x64-fd.pubxml b/Sharpy/Properties/PublishProfiles/publish-linux-x64-fd.pubxml similarity index 100% rename from CSharpBot/Properties/PublishProfiles/publish-linux-x64-fd.pubxml rename to Sharpy/Properties/PublishProfiles/publish-linux-x64-fd.pubxml diff --git a/CSharpBot/Properties/PublishProfiles/publish-linux-x64-sd.pubxml b/Sharpy/Properties/PublishProfiles/publish-linux-x64-sd.pubxml similarity index 100% rename from CSharpBot/Properties/PublishProfiles/publish-linux-x64-sd.pubxml rename to Sharpy/Properties/PublishProfiles/publish-linux-x64-sd.pubxml diff --git a/CSharpBot/Properties/PublishProfiles/publish-win-x64-fd.pubxml b/Sharpy/Properties/PublishProfiles/publish-win-x64-fd.pubxml similarity index 100% rename from CSharpBot/Properties/PublishProfiles/publish-win-x64-fd.pubxml rename to Sharpy/Properties/PublishProfiles/publish-win-x64-fd.pubxml diff --git a/CSharpBot/Properties/PublishProfiles/publish-win-x64-sd.pubxml b/Sharpy/Properties/PublishProfiles/publish-win-x64-sd.pubxml similarity index 100% rename from CSharpBot/Properties/PublishProfiles/publish-win-x64-sd.pubxml rename to Sharpy/Properties/PublishProfiles/publish-win-x64-sd.pubxml diff --git a/CSharpBot/CSharpBot.csproj b/Sharpy/Sharpy.csproj similarity index 74% rename from CSharpBot/CSharpBot.csproj rename to Sharpy/Sharpy.csproj index 47f10f6..691a1a1 100644 --- a/CSharpBot/CSharpBot.csproj +++ b/Sharpy/Sharpy.csproj @@ -17,26 +17,33 @@ false true true + Relms + Sharpy + 0.0.1.0 + 0.0.1.0 + en-US - true - false - none + true + false + none - true - full + true + full + + @@ -45,13 +52,14 @@ - - PreserveNewest - + + PreserveNewest + - + +