Esempio n. 1
0
        public async Task AddRank([Remainder] string name)
        {
            await Context.Channel.TriggerTypingAsync();

            var ranks = await _ranksHelper.GetRanksAsync(Context.Guild);

            var role = Context.Guild.Roles.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.CurrentCultureIgnoreCase));

            if (role == null)
            {
                await ReplyAsync("That role does not exist!");

                return;
            }

            if (role.Position > Context.Guild.CurrentUser.Hierarchy)
            {
                await ReplyAsync("That role has a higher position than the bot!");

                return;
            }

            if (ranks.Any(x => x.Id == role.Id))
            {
                await ReplyAsync("That role is already a rank!");

                return;
            }

            await _ranks.AddRankAsync(Context.Guild.Id, role.Id);

            await ReplyAsync($"The role {role.Mention} has been added to the ranks!");
        }
Esempio n. 2
0
        public async Task AddRank(SocketRole name)
        {
            await Context.Channel.TriggerTypingAsync();

            var ranks = await _ranksHelperClass.GetRankAsync(Context.Guild);

            var role = Context.Guild.Roles.FirstOrDefault(x => x.Id == name.Id);

            if (role == null)
            {
                await ReplyAsync("Role does not exist!!");

                return;
            }

            if (role.Position > Context.Guild.CurrentUser.Hierarchy)
            {
                await ReplyAsync("Role is higher than bot's!!!!");

                return;
            }

            if (ranks.Any(x => x.Id == role.Id))
            {
                await ReplyAsync("Role is already in the role list!");

                return;
            }

            await _ranks.AddRankAsync(Context.Guild.Id, role.Id);

            await RoleExtension.AddRankRoleEmbed(Context.Channel, role);
        }