diff --git a/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs b/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs index 25ab732..4f29f10 100644 --- a/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs +++ b/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs @@ -52,7 +52,7 @@ namespace Geekbot.net.Commands.Integrations.UbranDictionary if (!string.IsNullOrEmpty(definition.Example)) eb.AddField("Example", definition.Example ?? "(no example given...)"); if (!string.IsNullOrEmpty(definition.ThumbsUp)) eb.AddInlineField("Upvotes", definition.ThumbsUp); if (!string.IsNullOrEmpty(definition.ThumbsDown)) eb.AddInlineField("Downvotes", definition.ThumbsDown); - if (definitions.Tags.Length > 0) eb.AddField("Tags", string.Join(", ", definitions.Tags)); + if (definitions.Tags?.Length > 0) eb.AddField("Tags", string.Join(", ", definitions.Tags)); await ReplyAsync("", false, eb.Build()); } diff --git a/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs b/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs index e9ff92c..8ebee2e 100644 --- a/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs +++ b/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs @@ -39,7 +39,7 @@ namespace Geekbot.net.Lib.ErrorHandling { try { - var errorString = errorMessage == "def" ? await _translation.GetString(context.Guild.Id, "errorHandler", "SomethingWentWrong") : errorMessage; + var errorString = errorMessage == "def" ? await _translation.GetString(context.Guild?.Id ?? 0, "errorHandler", "SomethingWentWrong") : errorMessage; var errorObj = SimpleConextConverter.ConvertContext(context); if (e.Message.Contains("50007")) return; if (e.Message.Contains("50013")) return; diff --git a/Geekbot.net/Lib/Logger/SimpleConextConverter.cs b/Geekbot.net/Lib/Logger/SimpleConextConverter.cs index 5659896..8b8b0ed 100644 --- a/Geekbot.net/Lib/Logger/SimpleConextConverter.cs +++ b/Geekbot.net/Lib/Logger/SimpleConextConverter.cs @@ -25,13 +25,13 @@ namespace Geekbot.net.Lib.Logger }, Guild = new MessageDto.IdAndName { - Id = context.Guild.Id.ToString(), - Name = context.Guild.Name + Id = context.Guild?.Id.ToString(), + Name = context.Guild?.Name }, Channel = new MessageDto.IdAndName { - Id = context.Channel.Id.ToString(), - Name = context.Channel.Name + Id = context.Channel?.Id.ToString() ?? context.User.Id.ToString(), + Name = context.Channel?.Name ?? "DM-Channel" } }; } @@ -61,8 +61,8 @@ namespace Geekbot.net.Lib.Logger }, Channel = new MessageDto.IdAndName { - Id = channel?.Id.ToString(), - Name = channel?.Name + Id = channel?.Id.ToString() ?? message.Author.Id.ToString(), + Name = channel?.Name ?? "DM-Channel" } }; }