fruitbot
This library lets you use the game's API to automate everything in the Fruitcraft game. Basically, it provides the tools you need to write code that acts like a bot—playing the game for you, handling tasks, fighting battles, managing your tribe, upgrading assets, and more. With it, you can create programs that make the gameplay faster and easier, helping you grow in the game without manual effort.
Quick Start
from fruitbot import Client
from fruitbot.enums import CardPackTypes
bot = Client(session_name="fruit", restore_key="TOUR ACCOUNT RESTORE KEY")
data = bot.loadPlayer(save_session=True)
print(f"name: {data['name']}, amount of gold: {data['gold']}, id: {data['id']}")
print(bot.buyCardPack(CardPackTypes.BROWN_PACK))
Encryption Notice
The fruitbot library uses the latest encryption method by default to match the current Fruitcraft game version.
To use the older encryption (e.g. for legacy accounts or testing), set enc_version=1:
Client(session_name="fruit", restore_key="TOUR ACCOUNT RESTORE KEY", enc_version=1)
Processing Updates
You can utilize the decorators on_message_update(), on_player_status_update(), on_battle_alert(), on_battle_update(), on_auction_update() and on_tribe_membership_update() to receive and process the updates you need.
To start receiving updates, call the comebackToGame() method and set the open_socket argument to True.
For example:
from fruitbot import Client
from fruitbot.exceptions import OnlineOnAnotherDevice, PlayingOnAnotherDevice
from colorama import Fore
from time import sleep
bot = Client(session_name="fruit", restore_key="YOUR ACCOUNT RESTORE KEY")
try:
account_name = bot.loadPlayer(save_session=True)["name"]
except (OnlineOnAnotherDevice, PlayingOnAnotherDevice) as e:
print(e)
exit()
@bot.on_message_update()
def answerMessage(message: dict):
if "سلام" in message["text"] and message["sender"] != account_name:
bot.sendMessageToTribe(f"Hi {message['sender']}")
sleep(1)
print(f"{Fore.GREEN}\u202A{message['sender']}:\u202A{Fore.RESET} {message['text']}")
bot.comebackToGame(open_socket=True)
sleep(60)
bot.stopUpdates()
As demonstrated in the previous example, you can use the stopUpdates() method to terminate the reception of updates. Without invoking this method, updates will continue to be received forever, unless an issue arises.
If you ever need a specific update for any reason, @on_special_event() is here to assist you. The only required argument is push_message_type.
@bot.on_special_event("battle_help")
def helpTribemate():
# your code
pass
Metadata
Release files for fruitbot 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fruitbot-1.6.1.tar.gz | 26.6 kB | Without provenance | Details for fruitbot-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fruitbot-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for fruitbot-1.6.1-py3-none-any.whl |
Total release size: 54.4 kB
Release files / fruitbot-1.6.1.tar.gz
| Download URL | fruitbot-1.6.1.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b679a5fd9b0d09ef5b74786d0cf37c943b472cc8484dec1456ed1c0fd59fd3b5
|
|
BLAKE2b-256 checksum How to use checksums |
1c079f4fe6bef0cbccbdc6af807ed57f517a22963ec3c009f1d18412a4187069
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / fruitbot-1.6.1-py3-none-any.whl
| Download URL | fruitbot-1.6.1-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
802d3832e3d85438b1bdfd86ac5f3a962e89be198441393ec33e2b86b7ccde11
|
|
BLAKE2b-256 checksum How to use checksums |
12a0056fa4d80d7cab9b4ec115a5c5fc05faa6ab14cb673f5009d9f900a689e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for fruitbot 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.