Initialize the bot
Create a bot instance with a command prefix:The command prefix (
! in this example) is what users will type before commands.Add event handlers
Event handlers let your bot respond to events. Add a ready event to know when your bot is online:Add a friend request handler to automatically accept friend requests:
Complete example
Here’s the complete bot code:Using device auth (recommended)
For a more persistent bot that doesn’t require manual authorization each time, useAdvancedAuth:
Next steps
Commands extension
Learn more about creating commands and using the commands framework
Party management
Manage your bot’s party, members, and settings
Event handling
Understand all available events and how to use them
Error handling
Handle errors gracefully in your bot