Your First Bot
This guide will walk you through creating a simple Fortnite bot using rebootpy. By the end, you’ll have a bot that automatically accepts friend requests and responds to commands.Before starting, make sure you have installed rebootpy on your system.
Basic Bot Example
Create your bot file
Create a new Python file (e.g., This creates a basic bot with:
bot.py) and add the following code:- Authorization code authentication
- Auto-accept friend requests
- A
!hellocommand that responds with “Hello!”
Obtain an authorization code
To authenticate your bot, you need to get an authorization code:
- Log into the Epic Games account you want to use for your bot: Get Authorization Code
- Copy the value of the
authorizationCodefield from the JSON response
Run your bot
Execute your bot script:When prompted, paste the authorization code you obtained in the previous step.
Advanced Bot with Device Auth
For a production bot that persists authentication across restarts, useAdvancedAuth with device authentication:
How This Works
First Run
On the first run, the bot will:
- Open a browser window for device code authentication
- Generate device authentication credentials
- Save them to
device_auths.json
Keep your
device_auths.json file secure and private. It contains credentials that can be used to access your Epic Games account.Understanding the Code
Bot Initialization
command_prefix: The prefix for bot commands (e.g.,!hello,!help)auth: The authentication method to use
Events
Events are triggered by specific actions:event_ready event fires when the bot successfully connects and is ready to operate.
event_friend_request event fires when someone sends a friend request. This example automatically accepts all requests.
Commands
ctx parameter provides context like the sender and conversation.
Next Steps
Now that you have a working bot, explore more features:Authentication Methods
Learn about different authentication options
Events
Discover all available events
Commands
Build more complex command handlers
Party Management
Manage parties and party members
Common Issues
Authorization Code Expired
Authorization codes are single-use and expire quickly. If you get an authentication error:- Generate a new authorization code
- Consider using
AdvancedAuthfor persistent authentication
Bot Not Responding to Commands
Ensure:- You’re using the correct command prefix (default:
!) - You’re sending commands as friend messages to the bot
- The bot has successfully started (check for “Bot ready” message)
Import Errors
If you encounter import errors:- Verify rebootpy is installed:
pip list | grep rebootpy - Reinstall if necessary:
pip install -U rebootpy