Install script finished

This commit is contained in:
Master Kwoth
2017-06-04 11:40:34 +02:00
parent 747a834e60
commit bb96a01877
4 changed files with 60 additions and 15 deletions

View File

@ -25,6 +25,7 @@ using NadekoBot.Services.Administration;
using NadekoBot.Services.Permissions;
using NadekoBot.Services.Utility;
using NadekoBot.Services.Help;
using System.IO;
namespace NadekoBot
{
@ -63,6 +64,7 @@ namespace NadekoBot
{
SetupLogger();
_log = LogManager.GetCurrentClassLogger();
TerribleElevatedPermissionCheck();
Credentials = new BotCredentials();
Db = new DbService(Credentials);
@ -244,11 +246,11 @@ namespace NadekoBot
await LoginAsync(Credentials.Token).ConfigureAwait(false);
_log.Info("Loading serveices...");
_log.Info("Loading services...");
AddServices();
sw.Stop();
_log.Info("Connected in " + sw.Elapsed.TotalSeconds.ToString("F2"));
_log.Info($"Connected in {sw.Elapsed.TotalSeconds:F2} s");
var stats = Services.GetService<IStatsService>();
stats.Initialize();
@ -295,6 +297,21 @@ namespace NadekoBot
await Task.Delay(-1).ConfigureAwait(false);
}
private void TerribleElevatedPermissionCheck()
{
try
{
File.WriteAllText("test", "test");
File.Delete("test");
}
catch
{
_log.Error("You must run the application as an ADMINISTRATOR.");
Console.ReadKey();
Environment.Exit(2);
}
}
private static void SetupLogger()
{
try

View File

@ -4,6 +4,7 @@
<Description>General purpose Discord bot written in C#.</Description>
<Copyright>Kwoth</Copyright>
<Authors>Kwoth</Authors>
<PublisherName>Kwoth</PublisherName>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>NadekoBot</AssemblyName>
@ -20,7 +21,7 @@
<FileVersion>1.0.0.0</FileVersion>
<ApplicationIcon>nadeko_icon.ico</ApplicationIcon>
<RuntimeIdentifiers>win7-x64<!--;ubuntu.14.04-x64;osx.10.10-x64 --></RuntimeIdentifiers>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Version)' == '' ">
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">1.4.1</VersionPrefix>

View File

@ -41,8 +41,6 @@ namespace NadekoBot.Services.Administration
_mute = mute;
_prot = prot;
var sw = Stopwatch.StartNew();
GuildLogSettings = gcs
.ToDictionary(g => g.GuildId, g => g.LogSetting)
.ToConcurrent();
@ -69,9 +67,6 @@ namespace NadekoBot.Services.Administration
}
}, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
sw.Stop();
_log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s");
//_client.MessageReceived += _client_MessageReceived;
_client.MessageUpdated += _client_MessageUpdated;
_client.MessageDeleted += _client_MessageDeleted;