feat: donate amount

This commit is contained in:
xtaodada 2024-06-07 23:50:35 +08:00
parent 148a393068
commit 10c43d0647
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -9,12 +9,19 @@ from init import bot
filters.incoming & filters.command(["donate", f"donate@{bot.me.username}"]) filters.incoming & filters.command(["donate", f"donate@{bot.me.username}"])
) )
async def send_donate(_, message: Message): async def send_donate(_, message: Message):
amount = 10
try:
amount = int(message.command[1])
except Exception:
pass
if amount < 1 or amount > 1000:
amount = 10
await bot.send_invoice( await bot.send_invoice(
message.chat.id, message.chat.id,
title="Donate", title="Donate",
description="Support me", description="Support me",
currency="XTR", currency="XTR",
prices=[LabeledPrice(label="Star", amount=10)], prices=[LabeledPrice(label="Star", amount=amount)],
payload="stars" payload="stars"
) )