ilyarolf / AiogramShopBot

Aiogram Telegram bot shop with ways to deposit in USDT,LTC,BTC
MIT License
25 stars 8 forks source link
aiogram3 cryptocurrency shop sqlalchemy sqlcipher sqlite store telegram

AiogramShopBot

AiogramShopBot is a software product based on Aiogram3.x and SQLAlchemy that allows you to automate sales of digital goods in Telegram. One of the advantages of the bot is that AiogramShopBot implements the ability to top up with Bitcoin, Litecoin, USDT TRC-20, which allows you to sell digital goods worldwide.

1.Starting the bot

1.1 Starting AiogramShopBot with Docker-compose.

Note
To get the ngrok token, you need to register on the ngrok website and confirm your email. Then you will have the ngrok token in your personal account.

1.2 Starting AiogramShopBot without SQLCipher database encryption.

Note
Fully compatible with python 3.9.6.
AiogramShopBot from the master branch does not use database encryption via SQLCipher, but it does use Aiosqlite

WEBHOOK_PATH = "/bot"
WEBAPP_HOST = "localhost"
WEBAPP_PORT = 1234
TOKEN = "TELEGRAM_BOT_TOKEN_HERE"
ADMIN_ID_LIST = 123456,654321
SUPPORT_LINK = "https://t.me/your_username_123"
DB_NAME = "db_file_name.db"

1.3 Starting AiogramShopBot with SQLCipher database encryption.

Note
To run AiogramShopBot with database encryption via SQLCipher, it is recommended to use Linux kernel operating systems because installing SQLCipher on Windows is not the easiest.

WEBHOOK_PATH = "/bot"
WEBAPP_HOST = "localhost"
WEBAPP_PORT = 1234
TOKEN = "TELEGRAM_BOT_TOKEN_HERE"
ADMIN_ID_LIST = 123456,654321
SUPPORT_LINK = "https://t.me/your_username_123"
DB_NAME = "db_file_name.db"
DB_PASS = "your_password_to_database"

2.AiogramShopBot User's Manual

2.1 Registration

User registration occurs when the bot is first accessed with the /start command. Each user is assigned a different mnemonic phrase to generate BTC, LTC, USDT TRC20 crypto addresses. BTC and LTC addresses are generated according to BIP-84 standard, for USDT TRC20 the BIP-44 standard is used, this is done so that wallets can be easily imported into Trust Wallet.

2.2 Top-up balance

To deposit balance in the bot, go to "My Profile -> Top Up balance". Copy the address of the cryptocurrency you want to top up and send the cryptocurrency there, then go back to "My Profile" and click "Refresh Balance". Refreshing the balance takes some time (1-2 seconds).

Note "Refresh balance" button has a 30 second cooldown.

2.3 Purchase of goods

To buy any item, go to "All categories" -> Select any category -> Select any subcategory -> Select quantity -> Confirm purchase. If the purchase is successful, you will immediately receive a message in the format:

Item#1
Data: DataOfItem#1
Item#2
Data:DataOfItem#2
Item#3
Data:DataOfItem#3
Item#4
Data:DataOfItem#4
Item#5
Data:DataOfItem#5
Item#6
Data:DataOfItem#6
Item#7
Data:DataOfItem#7
Item#8
Data:DataOfItem#8
Item#9
Data:DataOfItem#9
Item#10
Data:DataOfItem#10

2.4 Purchase history

3.AiogramShopBot Admin Manual

3.1 Adding a new admin

To add a new admin you need to add his telegram id to the ADMIN_ID_LIST environment variable, separated by commas, and reload the bot.
For example: ADMIN_ID_LIST=123456,654321

3.2 Send to all bot users functionality

3.3 Adding new items to the bot

Note The functionality for adding new products so far supports adding products using .json files.

{
    "items": [
        {
            "category": "Category#1",
            "subcategory": "Subcategory#1",
            "price": 50,
            "description": "Mocked description",
            "private_data": "Mocked private data"
        },
        {
            "category": "Category#2",
            "subcategory": "Subcategory#2",
            "price": 100,
            "description": "Mocked description",
            "private_data": "Mocked private data"
        }
    ]
}

Note The "private_data" property is what the user gets when they make a purchase.

3.4 Send to everyone restocking message

Note Restocking message is generated automatically and looks as follows:

πŸ“… Update YYYY-MM-DD

πŸ“ Category Category#1

πŸ“„ Subcategory Subcategory#1 1 pcs

πŸ“ Category Category#2

πŸ“„ Subcategory Subcategory#2 1 pcs

3.5 Get new users

3.6 Delete categories and subcategories

3.7 Make refund

Note Refunds returns money to the user's balance in the bot.

3.8 Admin notifications

Note All users with telegram id in the .env ADMIN_ID_LIST environment variable will receive these notifications

3.8.1 Notification to admin about new deposit

New deposit by user with username @durov for $500 with 0.01 BTC
BTC address:bc1pvz78lx4lw0sutcu0l5szn74ke0hrkghvdg2u8wc705alr5hj9l4q8hzymp
Seed: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon

3.8.2 Notification to admin about new buy

After each purchase, you will receive a message in the format:

A new purchase by user @durov for the amount of $500.0 for the purchase of a 1 pcs SubcategoryName.

πŸ“‹ Todo List

✨ DONATE Buy Me Coffee