Fixed rotating status placeholders, permission mentioning
This commit is contained in:
		@@ -2,6 +2,7 @@
 | 
			
		||||
using Discord.Commands;
 | 
			
		||||
using Discord.WebSocket;
 | 
			
		||||
using NadekoBot.Attributes;
 | 
			
		||||
using NadekoBot.Extensions;
 | 
			
		||||
using NadekoBot.Services;
 | 
			
		||||
using NadekoBot.Services.Database;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
@@ -47,10 +48,13 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
                                if (!conf.RotatingStatusMessages.Any())
 | 
			
		||||
                                    continue;
 | 
			
		||||
 | 
			
		||||
                                var status = conf.RotatingStatusMessages[index++].Status;
 | 
			
		||||
                                if (string.IsNullOrWhiteSpace(status))
 | 
			
		||||
                                    continue;
 | 
			
		||||
                                PlayingPlaceholders.ForEach(e => status = status.Replace(e.Key, e.Value()));
 | 
			
		||||
                                await NadekoBot.Client
 | 
			
		||||
                                    .GetCurrentUser()
 | 
			
		||||
                                    .ModifyStatusAsync(mpp => mpp.Game = new Game(conf.RotatingStatusMessages[index++].Status))
 | 
			
		||||
                                    .ModifyStatusAsync(mpp => mpp.Game = new Game(status))
 | 
			
		||||
                                    .ConfigureAwait(false);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 
 | 
			
		||||
@@ -136,7 +136,10 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    com += $"<#{perm.PrimaryTargetId}>";
 | 
			
		||||
                    break;
 | 
			
		||||
                case PrimaryPermissionType.Role:
 | 
			
		||||
                    com += $"<@&{perm.PrimaryTargetId}>";
 | 
			
		||||
                    if(guild == null)
 | 
			
		||||
                        com += $"<@&{perm.PrimaryTargetId}>";
 | 
			
		||||
                    else
 | 
			
		||||
                        com += guild.GetRole(perm.PrimaryTargetId).ToString() ?? $"<@{perm.PrimaryTargetId}>";
 | 
			
		||||
                    break;
 | 
			
		||||
                case PrimaryPermissionType.Server:
 | 
			
		||||
                    break;
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,15 @@ namespace NadekoBot.Extensions
 | 
			
		||||
            http.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static IEnumerable<T> ForEach<T>(this IEnumerable<T> elems, Action<T> exec)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (var elem in elems)
 | 
			
		||||
            {
 | 
			
		||||
                exec(elem);
 | 
			
		||||
            }
 | 
			
		||||
            return elems;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void AddRange<T>(this HashSet<T> target, IEnumerable<T> elements) where T : class
 | 
			
		||||
        {
 | 
			
		||||
            foreach (var item in elements)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user