#105 Added check if user is assigned during server nickname fetching
This commit is contained in:
parent
cced819e77
commit
767b2b35d1
|
@ -240,7 +240,11 @@ namespace DML.AppCore.Classes
|
||||||
serverName = socketTextChannel.Guild.Name;
|
serverName = socketTextChannel.Guild.Name;
|
||||||
serverName = Path.GetInvalidFileNameChars()
|
serverName = Path.GetInvalidFileNameChars()
|
||||||
.Aggregate(serverName, (current, c) => current.Replace(c, ' '));
|
.Aggregate(serverName, (current, c) => current.Replace(c, ' '));
|
||||||
nickname = socketTextChannel.GetUser(message.Author.Id).Nickname;
|
|
||||||
|
var serverUser =
|
||||||
|
socketTextChannel.GetUser(message.Author.Id); // can be null if user left the server
|
||||||
|
if (serverUser != null)
|
||||||
|
nickname = serverUser.Nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
var channelName = message.Channel.Name;
|
var channelName = message.Channel.Name;
|
||||||
|
|
Loading…
Reference in a new issue