TGViewer
star source • استار سورس star source • استار سورس @star_sourcee · 26.5K subscribers
Post #1617 15.4K
❕ دریافت لحظه ای قیمت ارز های دیجیتال و قیمت پول کشور ها

⚪️ این کد کارش اینه که قیمت ارز هارو از وبسرویس میگیره و پیام توی کانال رو ۵ دقیقه یک بار ویرایش می‌کنه تا قیمت ها بروز بشه ( وبسرویس اول ۲۴ ساعت یک بار دومی ۵ دقیقه یک بار ) با باز کرد وبسرویس تا به صورت دستی میتونید قیمت هارو به صورت لحظه ای هم ببنید

✅ کد مورد نیاز :
from telegram import Bot
from telegram.error import TelegramError
import requests
import asyncio
BOT_TOKEN = ''#توکن
CHANNEL_ID = '' # آیدی عددی کانال
MESSAGE_1_ID = 332 # آیدی پیام دوم
MESSAGE_2_ID = 333 # آیدی پیام اول
bot = Bot(token=BOT_TOKEN)
def fetch_api_1():
url = "https://botx.website/Arz/index.php"
try:
response = requests.get(url)
if response.status_code == 200:
data = response.json().get("result", [])
message = "\n".join([f"{item['tag']} {item['currency']}: {item['price']} تومان" for item in data])
return message
else:
return "خطا در دریافت اطلاعات از API اول"
except Exception as e:
return f"خطا: {str(e)}"
def fetch_api_2():
url = "https://botx.website/Arz/arz.php"
try:
response = requests.get(url)
if response.status_code == 200:
return response.text.strip()
else:
return "خطا در دریافت اطلاعات از API دوم"
except Exception as e:
return f"خطا: {str(e)}"
async def update_message_1():
while True:
try:
content = fetch_api_1()
await bot.edit_message_text(chat_id=CHANNEL_ID, message_id=MESSAGE_1_ID, text=content)
except TelegramError as e:
print(f"خطا در ویرایش پیام اول: {e}")
await asyncio.sleep(24 * 60 * 60)

async def update_message_2():
while True:
try:
content = fetch_api_2()
await bot.edit_message_text(chat_id=CHANNEL_ID, message_id=MESSAGE_2_ID, text=content)
except TelegramError as e:
print(f"خطا در ویرایش پیام دوم: {e}")
await asyncio.sleep(5 * 60)
async def main():
await asyncio.gather(
update_message_1(),
update_message_2(),
)
if name == "main":
asyncio.run(main())

@Star_sourcee
More from @star_sourcee
  1. Aug 4, 2026📑 | سورس ربات ویروس توتال | ربات شناسایی فایل های مخرب 🔐 | ورژن : 3 💻 | زبان : PHP 8+ �…
  2. May 28, 2026سه ماه، مدت زمان کمی نیست!
  3. May 26, 2026‏شمارش معکوس برای حذف سوپراپلیکیشنای ایرانی... ⏳️
  4. May 26, 2026بالاخره بعد از ٣ ماه قطعی گسترده، روند اتصال اینترنت رسماً شروع شده و داره خیلی خوب پیش می…
  5. May 22, 2026بازی خیلی سادس!
  6. May 21, 2026کانفیگ جدید❗️ {دارای تک سرور فعال} با پروکسی ترکیب کنید https://t.me/proxy?server=31.47.51…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →