Fixes
This commit is contained in:
parent
e3adf55742
commit
0828130ae8
8 changed files with 16 additions and 17 deletions
|
@ -6,8 +6,8 @@ using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.net.Lib;
|
using Geekbot.net.Lib;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
using Utf8Json;
|
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Integrations.Google
|
namespace Geekbot.net.Commands.Integrations.Google
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ namespace Geekbot.net.Commands.Integrations.Google
|
||||||
|
|
||||||
var url = new Uri($"https://kgsearch.googleapis.com/v1/entities:search?languages=en&limit=1&query={searchText}&key={apiKey}");
|
var url = new Uri($"https://kgsearch.googleapis.com/v1/entities:search?languages=en&limit=1&query={searchText}&key={apiKey}");
|
||||||
var responseString = client.DownloadString(url);
|
var responseString = client.DownloadString(url);
|
||||||
var response = JsonSerializer.Deserialize<GoogleKgApiResponseDto>(responseString);
|
var response = JsonConvert.DeserializeObject<GoogleKgApiResponseDto>(responseString);
|
||||||
|
|
||||||
if (!response.ItemListElement.Any())
|
if (!response.ItemListElement.Any())
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ using Geekbot.net.Lib.Logger;
|
||||||
using Geekbot.net.Lib.UserRepository;
|
using Geekbot.net.Lib.UserRepository;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.User.Rank
|
namespace Geekbot.net.Commands.User.Ranking
|
||||||
{
|
{
|
||||||
public class Rank : ModuleBase
|
public class Rank : ModuleBase
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,7 @@ namespace Geekbot.net.Commands.User.Rank
|
||||||
[Command("rank", RunMode = RunMode.Async)]
|
[Command("rank", RunMode = RunMode.Async)]
|
||||||
[Remarks(CommandCategories.Statistics)]
|
[Remarks(CommandCategories.Statistics)]
|
||||||
[Summary("get user top 10 in messages or karma")]
|
[Summary("get user top 10 in messages or karma")]
|
||||||
public async Task RankCmd([Summary("type")] string typeUnformated = "messages",
|
public async Task RankCmd([Summary("type")] string typeUnformated = "messages", [Summary("amount")] int amount = 10)
|
||||||
[Summary("amount")] int amount = 10)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Geekbot.net.Commands.User.Rank
|
namespace Geekbot.net.Commands.User.Ranking
|
||||||
{
|
{
|
||||||
internal class RankUserPolyfillDto
|
internal class RankUserPolyfillDto
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Utils.Changelog
|
namespace Geekbot.net.Commands.Utils.Changelog
|
||||||
{
|
{
|
||||||
internal class CommitAuthorDto
|
public class CommitAuthorDto
|
||||||
{
|
{
|
||||||
public DateTimeOffset Date { get; set; }
|
public DateTimeOffset Date { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Geekbot.net.Commands.Utils.Changelog
|
namespace Geekbot.net.Commands.Utils.Changelog
|
||||||
{
|
{
|
||||||
internal class CommitDto
|
public class CommitDto
|
||||||
{
|
{
|
||||||
public CommitInfoDto Commit { get; set; }
|
public CommitInfoDto Commit { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Geekbot.net.Commands.Utils.Changelog
|
namespace Geekbot.net.Commands.Utils.Changelog
|
||||||
{
|
{
|
||||||
internal class CommitInfoDto
|
public class CommitInfoDto
|
||||||
{
|
{
|
||||||
public CommitAuthorDto AuthorDto { get; set; }
|
public CommitAuthorDto AuthorDto { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Geekbot.net.Lib.Logger
|
||||||
|
|
||||||
public void Trace(string source, string message, object extra = null)
|
public void Trace(string source, string message, object extra = null)
|
||||||
{
|
{
|
||||||
_logger.Trace(CreateLogString("Debug", source, message, null, extra));
|
_logger.Trace(CreateLogString("Trace", source, message, null, extra));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Debug(string source, string message, object extra = null)
|
public void Debug(string source, string message, object extra = null)
|
||||||
|
@ -65,7 +65,7 @@ namespace Geekbot.net.Lib.Logger
|
||||||
if (source != "Message") return $"[{source}] - {message}";
|
if (source != "Message") return $"[{source}] - {message}";
|
||||||
|
|
||||||
var m = (MessageDto) extra;
|
var m = (MessageDto) extra;
|
||||||
return $"[{source}] - [{m.Guild.Name} - {m.Channel.Name}] {m.User.Name}: {m.Message.Content}";
|
return $"[{source}] - [{m?.Guild.Name} - {m?.Channel.Name}] {m?.User.Name}: {m?.Message.Content}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,20 +17,20 @@ namespace Geekbot.net.Lib.Logger
|
||||||
{
|
{
|
||||||
Console.WriteLine("Logging Geekbot Logs to Sumologic");
|
Console.WriteLine("Logging Geekbot Logs to Sumologic");
|
||||||
config.LoggingRules.Add(
|
config.LoggingRules.Add(
|
||||||
new LoggingRule("*", LogLevel.Info, LogLevel.Fatal,
|
new LoggingRule("*", LogLevel.Debug, LogLevel.Fatal,
|
||||||
new BufferedSumoLogicTarget()
|
new BufferedSumoLogicTarget()
|
||||||
{
|
{
|
||||||
Url = Environment.GetEnvironmentVariable("GEEKBOT_SUMO"),
|
Url = Environment.GetEnvironmentVariable("GEEKBOT_SUMO"),
|
||||||
SourceName = "GeekbotLogger",
|
SourceName = "GeekbotLogger",
|
||||||
Layout = "${message}",
|
Layout = "${message}",
|
||||||
UseConsoleLog = false,
|
UseConsoleLog = true,
|
||||||
MaxQueueSizeBytes = 500000,
|
MaxQueueSizeBytes = 500000,
|
||||||
FlushingAccuracy = 250,
|
FlushingAccuracy = 250,
|
||||||
MaxFlushInterval = 10000,
|
MaxFlushInterval = 10000,
|
||||||
OptimizeBufferReuse = true,
|
OptimizeBufferReuse = true,
|
||||||
MessagesPerRequest = 10,
|
MessagesPerRequest = 10,
|
||||||
RetryInterval = 5000,
|
RetryInterval = 5000,
|
||||||
Name = "Geekbot"
|
Name = "GeekbotBeta"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,11 @@ namespace Geekbot.net.Lib.Logger
|
||||||
{
|
{
|
||||||
var minLevel = runParameters.Verbose ? LogLevel.Trace : LogLevel.Info;
|
var minLevel = runParameters.Verbose ? LogLevel.Trace : LogLevel.Info;
|
||||||
config.LoggingRules.Add(
|
config.LoggingRules.Add(
|
||||||
new LoggingRule("*", minLevel, LogLevel.Fatal,
|
new LoggingRule("*", LogLevel.Info, LogLevel.Fatal,
|
||||||
new ColoredConsoleTarget
|
new ColoredConsoleTarget
|
||||||
{
|
{
|
||||||
Name = "Console",
|
Name = "Console",
|
||||||
Encoding = Encoding.Unicode,
|
Encoding = Encoding.UTF8,
|
||||||
Layout = "[${longdate} ${level:format=FirstCharacter}] ${message} ${exception:format=toString}"
|
Layout = "[${longdate} ${level:format=FirstCharacter}] ${message} ${exception:format=toString}"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -53,7 +53,7 @@ namespace Geekbot.net.Lib.Logger
|
||||||
{
|
{
|
||||||
Name = "File",
|
Name = "File",
|
||||||
Layout = "[${longdate} ${level}] ${message}",
|
Layout = "[${longdate} ${level}] ${message}",
|
||||||
Encoding = Encoding.Unicode,
|
Encoding = Encoding.UTF8,
|
||||||
LineEnding = LineEndingMode.Default,
|
LineEnding = LineEndingMode.Default,
|
||||||
MaxArchiveFiles = 30,
|
MaxArchiveFiles = 30,
|
||||||
ArchiveNumbering = ArchiveNumberingMode.Date,
|
ArchiveNumbering = ArchiveNumberingMode.Date,
|
||||||
|
|
Loading…
Reference in a new issue