NRE fixes in simpleMessageConverter, !urban and errorHandler
This commit is contained in:
parent
6a163366ea
commit
5a4e710ef9
3 changed files with 8 additions and 8 deletions
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue