Small fix to custom reactions

This commit is contained in:
Kwoth 2016-10-15 14:40:01 +02:00
parent 40978c123d
commit 384e83f07f
3 changed files with 6 additions and 6 deletions

View File

@ -411,7 +411,7 @@ namespace NadekoBot.Modules.Administration
{ {
return cr.Value.Select(res => new CustomReaction() return cr.Value.Select(res => new CustomReaction()
{ {
GuildId = 0, GuildId = null,
IsRegex = false, IsRegex = false,
OwnerOnly = false, OwnerOnly = false,
Response = res, Response = res,

View File

@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Administration
if (channel == null) //maybe warn the server owner that the channel is missing if (channel == null) //maybe warn the server owner that the channel is missing
return; return;
var msg = conf.ChannelByeMessageText.Replace("%user%", user.Username + $" ({user.Id})").Replace("%server%", user.Guild.Name); var msg = conf.ChannelByeMessageText.Replace("%user%", user.Username).Replace("%id%", user.Id.ToString()).Replace("%server%", user.Guild.Name);
if (string.IsNullOrWhiteSpace(msg)) if (string.IsNullOrWhiteSpace(msg))
return; return;
try try
@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Administration
var channel = (await user.Guild.GetTextChannelsAsync()).SingleOrDefault(c => c.Id == conf.GreetMessageChannelId); var channel = (await user.Guild.GetTextChannelsAsync()).SingleOrDefault(c => c.Id == conf.GreetMessageChannelId);
if (channel != null) //maybe warn the server owner that the channel is missing if (channel != null) //maybe warn the server owner that the channel is missing
{ {
var msg = conf.ChannelGreetMessageText.Replace("%user%", user.Mention).Replace("%server%", user.Guild.Name); var msg = conf.ChannelGreetMessageText.Replace("%user%", user.Mention).Replace("%id%", user.Id.ToString()).Replace("%server%", user.Guild.Name);
if (!string.IsNullOrWhiteSpace(msg)) if (!string.IsNullOrWhiteSpace(msg))
{ {
try try

View File

@ -169,16 +169,16 @@ namespace NadekoBot.Modules.CustomReactions
if (toDelete == null) //not found if (toDelete == null) //not found
return; return;
if (toDelete.GuildId == null && channel == null) if ((toDelete.GuildId == null || toDelete.GuildId == 0) && channel == null)
{ {
uow.CustomReactions.Remove(toDelete); uow.CustomReactions.Remove(toDelete);
GlobalReactions.RemoveWhere(cr => cr.Id == toDelete.Id); GlobalReactions.RemoveWhere(cr => cr.Id == toDelete.Id);
success = true; success = true;
} }
else if (toDelete.GuildId != null && channel?.Guild.Id == toDelete.GuildId) else if ((toDelete.GuildId != null && toDelete.GuildId != 0) && channel?.Guild.Id == toDelete.GuildId)
{ {
uow.CustomReactions.Remove(toDelete); uow.CustomReactions.Remove(toDelete);
GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CustomReaction>()).RemoveWhere(cr=>cr.Id == toDelete.Id); GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CustomReaction>()).RemoveWhere(cr => cr.Id == toDelete.Id);
success = true; success = true;
} }
if(success) if(success)