I have the following method which takes the guild and role IDs:
async def getGuildRoleUsers(guildId : int, roleId : int):
foundUsers = []
logging.info(f"Getting guild for {guildId=}...")
guild = await bot.fetch_guild(guildId)
logging.info(f"Result: {guild=}.")
if (guild is None):
logging.warn("Found no guild, so returning.")
return foundUsers
logging.info(f"Getting role from {guild=} using {roleId=}...")
role = await guild.fetch_role(roleId, force=True)
logging.info(f"Result: {role=}.")
if (role is None):
logging.warn("Found no role, so returning.")
return foundUsers
# get users from role
logging.info(f"{role.members=}") # this only prints cached members in the role
return foundUsers
I have reviewed https://interactions-py.github.io/interactions.py/API Reference/API Reference/models/Discord/role/ and eventually ended up here: https://github.com/interactions-py/interactions.py/blob/stable/interactions/client/smart_cache.py#L680
But I can't seem to get the current non cached list of all members in the guild.