Friend
Represents a friend on Fortnite. Inherits from FriendBase and UserBase.
Properties
status
str - The friend’s status to the client. E.g. if the friend is friends with the bot it will be ACCEPTED.
This is not the same as status from presence!
incoming
bool - True if this friend was the one to send the friend request else False. Aliased to inbound as well.
inbound
bool - Alias for incoming.
outgoing
bool - True if the bot was the one to send the friend request else False. Aliased to outbound as well.
outbound
bool - Alias for outgoing.
created_at
datetime.datetime - The UTC time of when the friendship was created.
favorite
bool - True if the friend is favorited by ClientUser else False.
nickname
Optional[str] - The friend’s nickname. None if no nickname is set for this friend.
note
Optional[str] - The friend’s note. None if no note is set.
last_presence
Presence - The last presence retrieved by the friend. Might be None if no presence has been received by this friend yet.
last_logout
Optional[datetime.datetime] - The UTC time of the last time this friend logged off. None if this friend has never logged into Fortnite or because the friend was added after the client was started. If the latter is the case, you can fetch the friend’s last logout with fetch_last_logout().
Optional[Platform] - The platform the friend is currently online on. None if the friend is offline.
Methods
is_online()
Method to check if a user is currently online.
This method uses the last received presence from this user to determine if the friend is online or not. Therefore, this method will most likely not return True when calling it in event_friend_add(). You could use Client.wait_for() to wait for the presence to be received but remember that if the friend is in fact offline, no presence will be received. You can add a timeout to make sure it won’t wait forever.
Returns: bool - True if the friend is currently online else False.
wait_until_online()
async def wait_until_online() -> None
Waits until this friend comes online. Returns instantly if already online.
wait_until_offline()
async def wait_until_offline() -> None
Waits until this friend goes offline. Returns instantly if already offline.
fetch_last_logout()
async def fetch_last_logout() -> Optional[datetime.datetime]
Fetches the last time this friend logged out.
Raises:
HTTPException - An error occurred while requesting.
Returns: Optional[datetime.datetime] - The last UTC datetime of this friend’s last logout. Could be None if the friend has never logged into Fortnite.
fetch_mutual_friends()
async def fetch_mutual_friends() -> List[Friend]
Fetches a list of friends you and this friend have in common.
Raises:
HTTPException - An error occurred while requesting.
Returns: List[Friend] - A list of friends you and this friend have in common.
set_nickname(nickname)
async def set_nickname(nickname: str) -> None
Sets the nickname of this friend.
Parameters:
nickname (str) - The nickname you want to set. Min length: 3, Max length: 16.
Raises:
ValueError - The nickname contains too few/many characters or contains invalid characters.
HTTPException - An error occurred while requesting.
remove_nickname()
async def remove_nickname() -> None
Removes the friend’s nickname.
Raises:
HTTPException - An error occurred while requesting.
set_note(note)
async def set_note(note: str) -> None
Pins a note to this friend.
Parameters:
note (str) - The note you want to set. Min length: 3, Max length: 255.
Raises:
ValueError - The note contains too few/many characters or contains invalid characters.
HTTPException - An error occurred while requesting.
remove_note()
async def remove_note() -> None
Removes the friend’s note.
Raises:
HTTPException - An error occurred while requesting.
block()
async def block() -> None
Blocks this friend.
Raises:
HTTPException - Something went wrong when trying to block this user.
remove()
async def remove() -> None
Removes the friend from your friendlist.
Raises:
HTTPException - Something went wrong when trying to remove this friend.
send(content)
async def send(content: str) -> None
Sends a FriendMessage to this friend.
Parameters:
content (str) - The content of the message, up to 256 characters.
Raises:
ChatError - Content is longer than 256 characters.
join_party()
async def join_party() -> ClientParty
Attempts to join this friend’s party.
Raises:
PartyError - Party was not found.
Forbidden - The party you attempted to join was private.
HTTPException - Something else went wrong when trying to join the party.
Returns: ClientParty - The client’s new party.
invite()
async def invite() -> SentPartyInvitation
Invites this friend to your party.
Raises:
PartyError - Friend is already in your party or the party is full.
HTTPException - Something went wrong when trying to invite this friend.
Returns: SentPartyInvitation - Object representing the sent party invitation.
request_to_join()
async def request_to_join() -> None
Sends a request to join a friend’s party. This is mainly used for requesting to join private parties specifically, but it can be used for all types of party privacies.
If the request is accepted by the receiving friend, the bot will receive a regular party invitation. Unlike the Fortnite client, rebootpy will not automatically accept this invitation. You have to make some logic for doing that yourself.
Raises:
PartyError - You are already a part of this friend’s party.
FriendOffline - The friend you requested to join is offline.
HTTPException - An error occurred while requesting.
owns_offer(offer_id)
async def owns_offer(offer_id: str) -> bool
Checks if a friend owns a currently active offer in the item shop.
Parameters:
offer_id (str) - The offer ID to check.
Raises:
InvalidOffer - An invalid/outdated offer_id was passed. Only offers currently in the item shop are valid.
HTTPException - An error occurred while requesting.
Returns: bool - Whether or not the friend owns the offer.
fetch_avatar()
async def fetch_avatar() -> Avatar
Fetches this friend’s avatar.
Raises:
HTTPException - An error occurred while requesting.
Returns: Avatar - The avatar of the friend.