Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d22bf2ccbe | |||
d75dc4a2fb | |||
06740fc9ab | |||
cb0d4111d6 | |||
31fa855277 |
@ -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)
|
||||||
[](http://nadekobot.xyz)
|
[](https://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/)
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ namespace NadekoBot.Modules.Help
|
|||||||
public async Task Guide()
|
public async Task Guide()
|
||||||
{
|
{
|
||||||
await ConfirmLocalized("guide",
|
await ConfirmLocalized("guide",
|
||||||
"http://nadekobot.readthedocs.io/en/latest/Commands%20List/",
|
"http://nadekobot.readthedocs.io/en/1.3x/Commands%20List/",
|
||||||
"http://nadekobot.readthedocs.io/en/latest/").ConfigureAwait(false);
|
"http://nadekobot.readthedocs.io/en/1.3x/").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
@ -8,6 +8,9 @@ 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
|
||||||
{
|
{
|
||||||
@ -34,6 +37,7 @@ 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)
|
||||||
{
|
{
|
||||||
@ -114,6 +118,14 @@ 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) =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.CarbonKey))
|
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.CarbonKey))
|
||||||
@ -139,6 +151,32 @@ 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()
|
||||||
|
Reference in New Issue
Block a user