This commit is contained in:
Master Kwoth 2017-07-21 07:10:17 +02:00
parent b9bb72f06d
commit f1b348406d

View File

@ -105,6 +105,7 @@ namespace NadekoBot.Modules.Utility.Services
} }
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync().ConfigureAwait(false);
UpdateCache(guild.Id, streamRoleSettings);
} }
if (success) if (success)
{ {
@ -215,11 +216,15 @@ namespace NadekoBot.Modules.Utility.Services
&& !setting.Blacklist.Any(x => x.UserId == user.Id) && !setting.Blacklist.Any(x => x.UserId == user.Id)
&& user.RoleIds.Contains(setting.FromRoleId) && user.RoleIds.Contains(setting.FromRoleId)
&& (string.IsNullOrWhiteSpace(setting.Keyword) && (string.IsNullOrWhiteSpace(setting.Keyword)
|| user.Game.Value.Name.Contains(setting.Keyword) || user.Game.Value.Name.ToLowerInvariant().Contains(setting.Keyword.ToLowerInvariant())
|| setting.Whitelist.Any(x => x.UserId == user.Id))) || setting.Whitelist.Any(x => x.UserId == user.Id)))
{ {
try try
{ {
addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
if (addRole == null)
throw new StreamRoleNotFoundException();
//check if he doesn't have addrole already, to avoid errors //check if he doesn't have addrole already, to avoid errors
if (!user.RoleIds.Contains(setting.AddRoleId)) if (!user.RoleIds.Contains(setting.AddRoleId))
await user.AddRoleAsync(addRole).ConfigureAwait(false); await user.AddRoleAsync(addRole).ConfigureAwait(false);