admin管理员组文章数量:1123587
I have an error that I stumble upon. I can't figure out if there's something wrong with my code, or if this error occurs because I've tried to make an incorrect request from this account many times before, and now I'm temporarily (or permanently) banned. Last print says An error occurred: RPCError 400: STARGIFT_USAGE_LIMITED (caused by SendStarsFormRequest)
The purpose of the code: I want to buy a gift from my userbot's stars balance (currency='XTR') and send it to my friend.
this is the part of my code:
with TelegramClient(SESSION_NAME, API_ID, API_HASH) as client:
print("Userbot is running...")
try:
recipient = client.get_input_entity(RECIPIENT_USERNAME)
invoice = InputInvoiceStarGift(
user_id=recipient,
gift_id=GIFT_ID,
message=message,
hide_name=HIDE_NAME
)
print(f"Generated Invoice: {invoice}")
payment_form = client(GetPaymentFormRequest(invoice=invoice))
if payment_form:
print("Payment form retrieved successfully!")
print(payment_form.stringify())
payment_result = client(SendStarsFormRequest(
form_id=payment_form.form_id,
invoice=invoice
))
print(f"Payment successful: {payment_result.stringify()}")
except RPCError as e:
print(f"An error occurred: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
terminal:
Userbot is running...
Generated Invoice: InputInvoiceStarGift(user_id=InputPeerUser(user_id=***, access_hash=***), gift_id=6003767644426076664, hide_name=False, include_upgrade=None, message=TextWithEntities(text='good day!', entities=[MessageEntityBold(offset=0, length=9)]))
Payment form retrieved successfully!
PaymentFormStarGift(
form_id=7458202761376502076,
invoice=Invoice(
currency='XTR',
prices=[
LabeledPrice(
label='Total',
amount=10
),
],
test=False,
name_requested=False,
phone_requested=False,
email_requested=False,
shipping_address_requested=False,
flexible=False,
phone_to_provider=False,
email_to_provider=False,
recurring=False,
max_tip_amount=None,
suggested_tip_amounts=[
],
terms_url=None,
subscription_period=None
)
)
An error occurred: RPCError 400: STARGIFT_USAGE_LIMITED (caused by SendStarsFormRequest)
版权声明:本文标题:telegram api - telethon RPCError 400: STARGIFT_USAGE_LIMITED (caused by SendStarsFormRequest) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736583834a1944983.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论