Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
05ef845ed4 | |||
f4d5be0684 | |||
a7ca860607 | |||
dad789f6f5 | |||
f7eea8732f | |||
ffb7226cb8 | |||
741ba48c23 | |||
a46e6e5a96 | |||
60b736149f | |||
38f149c1e5 | |||
d1166c06a0 | |||
65bcda21c1 | |||
40ee70cd7e | |||
e9948009d9 |
@ -1,7 +1,7 @@
|
|||||||

|

|
||||||
[](https://discord.gg/nadekobot)
|
[](https://discord.gg/nadekobot)
|
||||||
[](http://nadekobot.readthedocs.io/en/latest/?badge=latest)
|
[](http://nadekobot.readthedocs.io/en/latest/?badge=latest)
|
||||||
[](https://nadekobot.me)
|
[](http://nadekobot.me)
|
||||||
[](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303)
|
[](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303)
|
||||||
[](http://nadekobot.readthedocs.io/en/latest/Commands%20List/)
|
[](http://nadekobot.readthedocs.io/en/latest/Commands%20List/)
|
||||||
|
|
||||||
|
@ -8,9 +8,6 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace NadekoBot.Services.Impl
|
namespace NadekoBot.Services.Impl
|
||||||
{
|
{
|
||||||
@ -37,7 +34,6 @@ namespace NadekoBot.Services.Impl
|
|||||||
public long CommandsRan => Interlocked.Read(ref _commandsRan);
|
public long CommandsRan => Interlocked.Read(ref _commandsRan);
|
||||||
|
|
||||||
private Timer carbonitexTimer { get; }
|
private Timer carbonitexTimer { get; }
|
||||||
private Timer _dataTimer { get; }
|
|
||||||
|
|
||||||
public StatsService(DiscordShardedClient client, CommandHandler cmdHandler)
|
public StatsService(DiscordShardedClient client, CommandHandler cmdHandler)
|
||||||
{
|
{
|
||||||
@ -117,14 +113,6 @@ namespace NadekoBot.Services.Impl
|
|||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
var platform = "other";
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
platform = "linux";
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
||||||
platform = "osx";
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
platform = "windows";
|
|
||||||
|
|
||||||
carbonitexTimer = new Timer(async (state) =>
|
carbonitexTimer = new Timer(async (state) =>
|
||||||
{
|
{
|
||||||
@ -151,32 +139,6 @@ namespace NadekoBot.Services.Impl
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}, null, TimeSpan.FromHours(1), TimeSpan.FromHours(1));
|
}, null, TimeSpan.FromHours(1), TimeSpan.FromHours(1));
|
||||||
|
|
||||||
_dataTimer = new Timer(async (state) =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var http = new HttpClient())
|
|
||||||
{
|
|
||||||
using (var content = new FormUrlEncodedContent(
|
|
||||||
new Dictionary<string, string> {
|
|
||||||
{ "id", string.Concat(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(NadekoBot.Credentials.ClientId.ToString())).Select(x => x.ToString("X2"))) },
|
|
||||||
{ "guildCount", _client.GetGuildCount().ToString() },
|
|
||||||
{ "version", BotVersion },
|
|
||||||
{ "platform", platform }}))
|
|
||||||
{
|
|
||||||
content.Headers.Clear();
|
|
||||||
content.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
|
|
||||||
|
|
||||||
await http.PostAsync("https://selfstats.nadekobot.me/", content).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}, null, TimeSpan.FromSeconds(1), TimeSpan.FromHours(1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
@ -209,4 +171,4 @@ Messages: {MessageCounter} [{MessagesPerSecond:F2}/sec] Heap: [{Heap} MB]");
|
|||||||
return $"{time.Days} days{separator}{time.Hours} hours{separator}{time.Minutes} minutes";
|
return $"{time.Days} days{separator}{time.Hours} hours{separator}{time.Minutes} minutes";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user