mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2024-09-20 15:05:56 +08:00
fix join vip
This commit is contained in:
parent
43e8a9ecf4
commit
1b12d1e56b
|
@ -27,15 +27,6 @@ from utils import apply_log_formatter
|
|||
apply_log_formatter()
|
||||
|
||||
|
||||
def get_username(chat_id):
|
||||
from ytdl_bot import create_app
|
||||
with tempfile.NamedTemporaryFile() as tmp:
|
||||
with create_app(tmp.name, 1) as app:
|
||||
data = app.get_chat(chat_id).first_name
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class VIP(Redis, MySQL):
|
||||
|
||||
def check_vip(self, user_id: "int") -> "tuple":
|
||||
|
@ -258,7 +249,7 @@ class Afdian:
|
|||
return level, amount, trade_no
|
||||
|
||||
|
||||
def verify_payment(user_id, unique) -> "str":
|
||||
def verify_payment(user_id, unique, client) -> "str":
|
||||
if not ENABLE_VIP:
|
||||
return "VIP is not enabled."
|
||||
logging.info("Verifying payment for %s - %s", user_id, unique)
|
||||
|
@ -278,7 +269,7 @@ def verify_payment(user_id, unique) -> "str":
|
|||
vip = VIP()
|
||||
ud = {
|
||||
"user_id": user_id,
|
||||
"username": get_username(user_id),
|
||||
"username": client.get_chat(user_id).first_name,
|
||||
"payment_amount": amount,
|
||||
"payment_id": pay_id,
|
||||
"level": level,
|
||||
|
|
|
@ -218,7 +218,7 @@ def vip_handler(client: "Client", message: "types.Message"):
|
|||
else:
|
||||
bm: typing.Union["types.Message", "typing.Any"] = message.reply_text(bot_text.vip_pay, quote=True)
|
||||
unique = text.replace("/vip", "").strip()
|
||||
msg = verify_payment(chat_id, unique)
|
||||
msg = verify_payment(chat_id, unique, client)
|
||||
bm.edit_text(msg)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue