コード例 #1
0
        public async Task <GuildPermission> GetPermissionsAsync(IDiscordGuildUser user = null)
        {
            IDiscordGuild guild = await GetGuildAsync();

            if (user == null)
            {
                user = await guild.GetSelfAsync();
            }
            GuildPermission permissions = await guild.GetPermissionsAsync(user);

            return(DiscordChannelHelper.GetOverwritePermissions(user, this, permissions));
        }
コード例 #2
0
        public async Task <string> Print(int currentValue, IDiscordGuild g, IDiscordGuildChannel c)
        {
            string output = "";

            IDiscordGuildUser u = await g.GetSelfAsync();

            if (!(await c.GetPermissionsAsync(u)).HasFlag(GuildPermission.UseExternalEmojis))
            {
                return("");
            }

            int iteration        = MaxValue / Width;
            int currentIteration = iteration;

            for (int i = 0; i < Width; i++)
            {
                output           += (currentValue >= currentIteration) ? ValueOn.GetAppropriateSection(0, Width - 1, i) : ValueOff.GetAppropriateSection(0, Width - 1, i);
                currentIteration += iteration;
            }

            return(output);
        }