Dont crash if a mention is sent in PM
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Discord
|
|||||||
text = _userRegex.Replace(text, new MatchEvaluator(e =>
|
text = _userRegex.Replace(text, new MatchEvaluator(e =>
|
||||||
{
|
{
|
||||||
string id = e.Value.Substring(2, e.Value.Length - 3);
|
string id = e.Value.Substring(2, e.Value.Length - 3);
|
||||||
var user = client.Users[id, server.Id];
|
var user = client.Users[id, server?.Id];
|
||||||
if (user != null)
|
if (user != null)
|
||||||
return '@' + user.Name;
|
return '@' + user.Name;
|
||||||
else //User not found
|
else //User not found
|
||||||
@@ -34,7 +34,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
string id = e.Value.Substring(2, e.Value.Length - 3);
|
string id = e.Value.Substring(2, e.Value.Length - 3);
|
||||||
var channel = client.Channels[id];
|
var channel = client.Channels[id];
|
||||||
if (channel != null && channel.Server.Id == server.Id)
|
if (channel != null && channel.Server?.Id == server?.Id)
|
||||||
return '#' + channel.Name;
|
return '#' + channel.Name;
|
||||||
else //Channel not found
|
else //Channel not found
|
||||||
return '#' + e.Value;
|
return '#' + e.Value;
|
||||||
|
|||||||
Reference in New Issue
Block a user