diff options
| -rw-r--r-- | AleeBot/AleeBot.csproj | 6 | ||||
| -rw-r--r-- | AleeBot/Modules/Uptime.cs | 16 | ||||
| -rw-r--r-- | AleeBot/Program.cs | 2 | ||||
| -rw-r--r-- | README.md | 2 |
4 files changed, 21 insertions, 5 deletions
diff --git a/AleeBot/AleeBot.csproj b/AleeBot/AleeBot.csproj index 1c9108d..1997e7a 100644 --- a/AleeBot/AleeBot.csproj +++ b/AleeBot/AleeBot.csproj @@ -3,9 +3,9 @@ <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.0</TargetFramework> - <Version>3.0.0</Version> + <Version>3.1.0</Version> <Authors>Andrew Lee</Authors> - <Copyright>(C) Copyright 2019</Copyright> + <Copyright>(C) Copyright 2015-2019</Copyright> <NeutralLanguage>en</NeutralLanguage> <Company>AleeCorp</Company> <ApplicationIcon>AleeBot.ico</ApplicationIcon> @@ -13,10 +13,12 @@ <RootNamespace>AleeBot</RootNamespace> <RepositoryUrl>https://github.com/AleeCorp/AleeBot.NET</RepositoryUrl> <SignAssembly>false</SignAssembly> + <GeneratePackageOnBuild>false</GeneratePackageOnBuild> </PropertyGroup> <ItemGroup> <PackageReference Include="Discord.Net" Version="2.0.1" /> + <PackageReference Include="System.Diagnostics.PerformanceCounter" Version="4.5.0" /> <PackageReference Include="System.IO.FileSystem" Version="4.3.0" /> </ItemGroup> </Project> diff --git a/AleeBot/Modules/Uptime.cs b/AleeBot/Modules/Uptime.cs index 410d544..502cca9 100644 --- a/AleeBot/Modules/Uptime.cs +++ b/AleeBot/Modules/Uptime.cs @@ -17,6 +17,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * **********************************************/ +using System; +using System.Diagnostics; using Discord; using Discord.Commands; using System.Threading.Tasks; @@ -31,9 +33,19 @@ namespace AleeBot.Modules var embed = new EmbedBuilder(); embed.WithTitle("AleeBot Uptime"); embed.WithColor(Color.Green); - embed.AddField("System Uptime", "Coming Soon!"); + embed.AddField("System Uptime", SysUptime()); embed.AddField("Bot Uptime", "Coming Soon!"); await Context.Channel.SendMessageAsync(embed: embed.Build()); - } + } + + public TimeSpan SysUptime() + { + using (var uptime = new PerformanceCounter("System", "System Up Time")) + { + uptime.NextValue(); + return TimeSpan.FromSeconds(uptime.NextValue()); + } + + } } } diff --git a/AleeBot/Program.cs b/AleeBot/Program.cs index c6d10f4..54cd816 100644 --- a/AleeBot/Program.cs +++ b/AleeBot/Program.cs @@ -45,6 +45,7 @@ namespace AleeBot else { Console.WriteLine("[ERROR] token.txt isn't found."); + Console.ReadKey(); Environment.Exit(0); } } @@ -69,7 +70,6 @@ namespace AleeBot _client.Ready += () => { Console.WriteLine($"[SUCCESS] AleeBot {Data.Version} is now ready!"); - return Task.CompletedTask; }; @@ -1,2 +1,4 @@ # AleeBot.NET A Discord bot that's made in Discord.NET, .NET Core 3.0 and a revival. + +[](https://ci.appveyor.com/project/Alee14/aleebot-net/branch/master)
\ No newline at end of file |
