Fixed some console log spam which was incorrectly done by streamrole feature, upped version to 3.0.10 in stats

This commit is contained in:
Kwoth
2021-12-01 07:02:01 +01:00
parent 71f1e43272
commit 1e6d0806d7
2 changed files with 10 additions and 4 deletions

View File

@@ -227,6 +227,9 @@ namespace NadekoBot.Modules.Utility.Services
private async Task RescanUser(IGuildUser user, StreamRoleSettings setting, IRole addRole = null)
{
if (user.IsBot)
return;
var g = (StreamingGame)user.Activities
.FirstOrDefault(a => a is StreamingGame &&
(string.IsNullOrWhiteSpace(setting.Keyword)
@@ -240,7 +243,7 @@ namespace NadekoBot.Modules.Utility.Services
{
try
{
addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
addRole ??= user.Guild.GetRole(setting.AddRoleId);
if (addRole is null)
{
await StopStreamRole(user.Guild).ConfigureAwait(false);
@@ -249,9 +252,12 @@ namespace NadekoBot.Modules.Utility.Services
}
//check if he doesn't have addrole already, to avoid errors
if (!user.RoleIds.Contains(setting.AddRoleId))
if (!user.RoleIds.Contains(addRole.Id))
{
await user.AddRoleAsync(addRole).ConfigureAwait(false);
Log.Information("Added stream role to user {0} in {1} server", user.ToString(), user.Guild.ToString());
Log.Information("Added stream role to user {0} in {1} server", user.ToString(),
user.Guild.ToString());
}
}
catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.Forbidden)
{