@client.eventasync def event_ready(): # Set party to public await client.party.set_privacy(rebootpy.PartyPrivacy.PUBLIC) # Set party to friends only await client.party.set_privacy(rebootpy.PartyPrivacy.FRIENDS) # Set party to private await client.party.set_privacy(rebootpy.PartyPrivacy.PRIVATE)
You can also set the default privacy when creating the client:
# By display name or IDmember = client.party.get_member('Username')if member: print(f'Found {member.display_name}')# By predicate functionmember = client.party.find_member(lambda m: m.outfit == 'CID_175_Athena_Commando_M_Celestial')
@client.eventasync def event_party_member_join(member): # Kick members who aren't friends if member.id not in [f.id for f in client.friends]: await member.kick()
@client.eventasync def event_party_message(message): if message.content == '!promote': member = client.party.get_member(message.author.id) if member: await member.promote()
# Join a friend's partyfriend = client.get_friend('FriendName')if friend and friend.party: await friend.party.join()# Join via party IDawait client.join_party(party_id)
@client.eventasync def event_party_invitation(invitation): # Auto-accept invites from friends if invitation.sender.id in [f.id for f in client.friends]: await invitation.accept() else: await invitation.decline()
@client.eventasync def event_party_member_join(member): print(f'{member.display_name} joined the party')@client.eventasync def event_party_member_leave(member): print(f'{member.display_name} left the party')@client.eventasync def event_party_update(party): print(f'Party updated')@client.eventasync def event_party_member_update(member): print(f'{member.display_name} updated their member state')@client.eventasync def event_party_member_promote(old_leader, new_leader): print(f'{new_leader.display_name} is now the party leader')@client.eventasync def event_party_member_kick(member): print(f'{member.display_name} was kicked')@client.eventasync def event_party_member_disconnect(member): print(f'{member.display_name} disconnected')
@client.eventasync def event_party_member_update(member): # Check if all members (except us) are ready all_ready = all( m.ready != rebootpy.ReadyState.NOT_READY for m in client.party.members if m.id != client.user.id ) if all_ready: await client.party.me.set_ready(rebootpy.ReadyState.READY)
@client.eventasync def event_party_member_join(member): if client.party.member_count > 4: # Kick new member if party is full if member.id != client.user.id: await member.kick()