function GroupUtils.promiseGroupRoleInfo(c,g)assert(c,"\066\097\100 \103\114\111\117\112\073\100")assert(g,"\066\097\100 \114\097\110\107\073\100")return(GroupUtils.promiseGroupInfo(c)):Then(function(c)if type(c.Roles)~="\116\097\098\108\101"then return Promise.rejected("\078\111 \082\111\108\101\115 \116\097\098\108\101")end for c,o in pairs(c.Roles)do if o.Rank==g then return o end end return Promise.rejected("\078\111 \114\097\110\107 \119\105\116\104 \103\105\118\101\110 \105\100")end)end return GroupUtils

function GroupUtils.promiseGroupRoleInfo(groupId, rankId)
	assert(groupId, "Bad groupId")
	assert(rankId, "Bad rankId")

	return GroupUtils.promiseGroupInfo(groupId)
		:Then(function(groupInfo)
			if type(groupInfo.Roles) ~= "table" then
				return Promise.rejected("No Roles table")
			end

			for _, rankInfo in pairs(groupInfo.Roles) do
				if rankInfo.Rank == rankId then
					return rankInfo
				end
			end

			return Promise.rejected("No rank with given id")
		end)
end

return GroupUtils
