aboutsummaryrefslogtreecommitdiff
path: root/AleeBot
diff options
context:
space:
mode:
authorAlee <Alee14498@gmail.com>2019-05-12 22:32:44 -0400
committerAlee <Alee14498@gmail.com>2019-05-12 22:32:44 -0400
commit39d0c3f0aafd19388e44c72a8841c757f435d1a2 (patch)
tree6f2019cc04fb831c1425cfb53a75430742b5a11a /AleeBot
parentef4fefa80725aceb45364e3e309db1dc0babc2de (diff)
downloadAleeBot.NET-beta.tar.gz
AleeBot.NET-beta.tar.bz2
AleeBot.NET-beta.zip
Started working on uptime and added a packagebeta
Diffstat (limited to 'AleeBot')
-rw-r--r--AleeBot/AleeBot.csproj6
-rw-r--r--AleeBot/Modules/Uptime.cs16
-rw-r--r--AleeBot/Program.cs2
3 files changed, 19 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;
};