This is a simple Discord bot that uses the PayPal API 2 to process payments and manage roles. It allows administrators to create payments, check payment status, and automatically update roles based on successful payments.
- Create a PayPal order for a user.
- Generate a QR code with the approval link for the user to scan.
- Check the payment status of an order.
- Automatically update the user's role based on successful payments.
- Handles errors and exceptions gracefully.
- Python 3.8+
- Discord.py 2.0+
- aiohttp 3.8+
- pymysql 1.0.2+
- qrcode 7.3+
- A Discord bot token
- A PayPal account with API credentials (Client ID and Secret)
- A MySQL database
I. Clone the repository:
git [email protected]:BosonsHiggs/doletaBot.git
On Linux or MacOS:
export DISCORD_BOT_TOKEN='your_discord_bot_token'
export PAYPAL_BOT_ID='your_paypal_client_id'
export PAYPAL_BOT_SECRET='your_paypal_secret'
export MYSQL_USER='your_mysql_user'
export MYSQL_PASSWORD='your_mysql_password'
export MYSQL_DATABASE='your_database_name'
On Windows:
```bash
set DISCORD_BOT_TOKEN='your_discord_bot_token'
set PAYPAL_BOT_ID='your_paypal_client_id'
set PAYPAL_BOT_SECRET='your_paypal_secret'
set MYSQL_USER='your_mysql_user'
set MYSQL_PASSWORD='your_mysql_password'
set MYSQL_DATABASE='your_database_name'
To install and configure the Discord Doleta Bot, follow the steps below:
- Clone the repository.
- Install the necessary dependencies using pip install -r requirements.txt.
- Create a .env file in the project root and add your PayPal and MySQL database credentials, along with the Discord bot token and any other necessary information.
- Set up the MySQL database to store payments.
- Start the bot by running python main.py.
Update your package list:
sudo apt update
Install the MySQL server package:
sudo apt install mysql-server
Start the MySQL service:
sudo systemctl start mysql
Enable MySQL to start at boot:
sudo systemctl enable mysql
Run the MySQL secure installation script to secure your database server:
sudo mysql_secure_installation
Log in to MySQL as the root user:
sudo mysql -u root -p
Create a new database:
CREATE DATABASE mydb;
Create a new user and set a password for the user:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
Grant all privileges for the new user on the new database:
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
Flush privileges to apply the changes:
FLUSH PRIVILEGES;
Exit MySQL:
EXIT;
Now you have MySQL set up on your Linux or Windows system, and you can use the new database and user for your application.
To use the bot, you need to be an administrator of your Discord server. The bot provides the following commands:
- /payment : Create a PayPal order for the specified amount.
- /verify_order <order_id>: Check the payment status of an order.
- /delete_all_table: Delete the payments table from the database.
The bot will automatically update the user's role and send a message in the specified channel when a payment is successful.
This bot uses the PayPal sandbox environment for testing. Replace the sandbox URLs with production URLs for real transactions. Make sure the bot has the necessary permissions to manage roles in your Discord server.
This project is for educational purposes only. Use it at your own risk. The author is not responsible for any consequences resulting from the use of this bot.
- Autor: Aril Ogai and Vexy
- Contato do Discord: Aril Ogai#5646 and Vexy#1212
- E-mail de suporte: [email protected]