Open minion6011 opened 3 weeks ago
ill look into it
It seems to work fine for me, I can hide myself while in the bots party, can you share the code you're using to hide yourself?
@discord_bot.command()
async def test(ctx, name, value:str):
#https://rebootpy.readthedocs.io/en/latest/api.html?highlight=party#rebootpy.ClientParty.set_squad_assignments
try:
fn_client = online_fn_client[str(ctx.author.id)]
user = await fn_client.fetch_user(name)
party_user = fn_client.party.get_member(user.id)
assignments_value = {}
if value == "true":
assignments_value[party_user] = rebootpy.SquadAssignment(hidden=True)
elif value == "false":
assignments_value[party_user] = rebootpy.SquadAssignment(hidden=False)
await fn_client.party.set_squad_assignments(assignments=assignments_value)
except Exception as e:
print(e)
Using that same code seems to work fine for me, are you running 0.9.3 or the latest GitHub version and is the bot party leader?
@bot.command()
async def hide2(ctx, name, value: str) -> None:
try:
fn_client = bot
user = await fn_client.fetch_user(name)
party_user = fn_client.party.get_member(user.id)
assignments_value = {}
if value == "true":
assignments_value[party_user] = rebootpy.SquadAssignment(
hidden=True
)
elif value == "false":
assignments_value[party_user] = rebootpy.SquadAssignment(
hidden=False
)
await fn_client.party.set_squad_assignments(
assignments=assignments_value
)
except Exception as e:
print(e)
I'm going to add a .hide()
function to PartyMember
to make it simpler and please let me know if that fixes the issue for you, I was planning on doing this sometime in the future anyway.
No, I was using an old version, now I updated the version to 0.9.3. The command runs without errors but it does not work, could it be a problem if it is a Lobby Bot network and there is no auth.json file?
the error is because asyncio.Lock()
/ client_fn.party.edit_lock.locked()
that return false, in the code of the library is used in party.py
in refresh_squad_assignments
:
check = not self.edit_lock.locked() if could_be_edit else True
if check:
#code...
Thanks for letting me know, I'll look into it again.
Do you do anything specific before attempting to hide party members? It's never locked for me and I tried multiple times. Also, does hiding always never work?
for me it is locked because the bot is executed inside a function because it is a starbot
When I use set_squad_assignments with hide=True on a member the member and the bot will become the leader of the lobby