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()
{
GuildId = 0,
GuildId = null,
IsRegex = false,
OwnerOnly = false,
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
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))
return;
try
@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Administration
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
{
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))
{
try

View File

@ -169,13 +169,13 @@ namespace NadekoBot.Modules.CustomReactions
if (toDelete == null) //not found
return;
if (toDelete.GuildId == null && channel == null)
if ((toDelete.GuildId == null || toDelete.GuildId == 0) && channel == null)
{
uow.CustomReactions.Remove(toDelete);
GlobalReactions.RemoveWhere(cr => cr.Id == toDelete.Id);
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);
GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CustomReaction>()).RemoveWhere(cr => cr.Id == toDelete.Id);