Skip to main content

کتابخانه رسمی روبیکا - ساخت ربات‌های توکنی - سلف

Project description

🤖 Rubiko - کتابخانه رسمی روبیکا

کتابخانه قدرتمند برای ساخت ربات‌های توکنی و سلف روبیکا


📦 نصب

pip install rubiko


🚀 شروع سریع

ربات توکنی

from rubiko import RubikaBot

bot = RubikaBot("YOUR_BOT_TOKEN") bot.send_message("chat_id", "سلام!") bot.run()

ربات سلف (اکانت شخصی)

from rubiko import RubikaSelfBot

selfbot = RubikaSelfBot("09123456789") selfbot.send_code() code = input("کد تایید: ") selfbot.verify_code(code) selfbot.send_message("chat_id", "سلام!") selfbot.run()


📖 متدهای RubikaBot

ارسال پیام

send_message(chat_id, text, reply_to=None, parse_mode=None) - ارسال پیام متنی با قابلیت ریپلای send_photo(chat_id, photo_path, caption="") - ارسال عکس send_video(chat_id, video_path, caption="") - ارسال ویدیو send_audio(chat_id, audio_path, caption="") - ارسال صدا send_document(chat_id, file_path, caption="") - ارسال فایل send_sticker(chat_id, sticker_path) - ارسال استیکر send_voice(chat_id, voice_path, caption="") - ارسال ویس send_animation(chat_id, gif_path, caption="") - ارسال گیف send_location(chat_id, lat, lon) - ارسال موقعیت send_contact(chat_id, phone, first_name, last_name="") - ارسال مخاطب send_poll(chat_id, question, options, is_anonymous=True) - ارسال نظرسنجی

مدیریت پیام

edit_message_text(chat_id, msg_id, new_text, parse_mode=None) - ویرایش متن edit_message_caption(chat_id, msg_id, new_caption) - ویرایش کپشن delete_message(chat_id, msg_id) - حذف پیام forward_message(chat_id, from_chat, msg_id) - فوروارد پیام copy_message(chat_id, from_chat, msg_id) - کپی پیام pin_message(chat_id, msg_id) - پین کردن پیام unpin_message(chat_id, msg_id) - آنپین کردن پیام unpin_all_messages(chat_id) - آنپین کردن همه پیام‌ها

دریافت اطلاعات

get_me() - اطلاعات ربات get_chat(chat_id) - اطلاعات چت get_chat_member(chat_id, user_id) - اطلاعات یک عضو get_chat_administrators(chat_id) - لیست ادمین‌ها get_chat_members_count(chat_id) - تعداد اعضا get_updates(offset=None, limit=100) - دریافت پیام‌های جدید get_file(file_id) - اطلاعات فایل download_file(file_id, destination) - دانلود فایل

مدیریت گروه

kick_chat_member(chat_id, user_id, until_date=None) - اخراج عضو (با امکان زمان‌دار) unban_chat_member(chat_id, user_id) - آنبان کردن عضو restrict_chat_member(chat_id, user_id, until_date=None) - محدودیت عضو promote_chat_member(chat_id, user_id) - ترفیع به ادمین set_chat_title(chat_id, title) - تغییر عنوان گروه set_chat_description(chat_id, description) - تغییر توضیحات گروه set_chat_photo(chat_id, photo_path) - تغییر عکس گروه delete_chat_photo(chat_id) - حذف عکس گروه export_chat_invite_link(chat_id) - ساخت لینک دعوت

وب‌هوک

set_webhook(url) - تنظیم وب‌هوک delete_webhook() - حذف وب‌هوک get_webhook_info() - اطلاعات وب‌هوک

اکشن‌ها

send_chat_action(chat_id, action) - ارسال وضعیت (تایپ، آپلود و...) typing(chat_id) - نمایش وضعیت تایپ upload_photo(chat_id) - نمایش وضعیت آپلود عکس upload_video(chat_id) - نمایش وضعیت آپلود ویدیو upload_audio(chat_id) - نمایش وضعیت آپلود صدا upload_document(chat_id) - نمایش وضعیت آپلود فایل

پاسخ به درخواست‌ها

answer_callback_query(callback_id, text, show_alert=False) - پاسخ به دکمه‌های شیشه‌ای answer_inline_query(inline_query_id, results) - پاسخ به درخواست‌های inline

ترجمه

translate_text(text, target_language="fa") - ترجمه متن enable_auto_translate_to_persian() - فعال کردن ترجمه خودکار به فارسی disable_auto_translate() - غیرفعال کردن ترجمه خودکار

پروکسی

bot = RubikaBot("TOKEN", proxy="https://api.rubka.ir") - رفع تحریم


🎛️ کیبوردها

from rubiko import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove

کیبورد شیشه‌ای

keyboard = InlineKeyboardMarkup() keyboard.add( InlineKeyboardButton("دکمه ۱", callback_data="data1"), InlineKeyboardButton("وبسایت", url="https://rubika.ir") ) bot.send_message("chat_id", "متن", reply_markup=keyboard)

کیبورد معمولی

keyboard = ReplyKeyboardMarkup([ ["دکمه ۱", "دکمه ۲"], ["دکمه ۳"] ]) bot.send_message("chat_id", "متن", reply_markup=keyboard)

حذف کیبورد

bot.send_message("chat_id", "متن", reply_markup=ReplyKeyboardRemove())


📡 هندلرها

@bot.on("message") def handle_message(msg): bot.send_message(msg.chat.id, f"سلام {msg.from_user.first_name}!")

@bot.on("command_start") def handle_start(msg, args): bot.send_message(msg.chat.id, "به ربات خوش اومدی!")

@bot.on("callback_query") def handle_callback(callback): bot.answer_callback_query(callback.id, "✅ انجام شد!")

@bot.on("inline_query") def handle_inline(inline): results = [{ "id": "1", "type": "article", "title": "نتیجه", "input_message_content": { "message_text": f"شما جستجو کردید: {inline.query}" } }] bot.answer_inline_query(inline.id, results)


🎨 ParseMode (HTML/Markdown)

from rubiko import ParseMode

bot.send_message("chat_id", "متن پررنگ", parse_mode=ParseMode.HTML) bot.send_message("chat_id", "متن ایتالیک", parse_mode=ParseMode.MARKDOWN)


🛡️ مدیریت خطا

from rubiko import RubikoError

try: bot.send_message("chat_id", "سلام!") except RubikoError as e: print(f"خطا: {e}")


👨‍💻 سازنده

رادین کریمی

📢 کانال رسمی

@rubiko_official

🌍 لینک‌ها

PyPI: https://pypi.org/project/rubiko/ GitHub: https://github.com/rubiko-radinkarimi


ساخته شده با ❤️ توسط رادین کریمی

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rubiko-1.0.6.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rubiko-1.0.6-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file rubiko-1.0.6.tar.gz.

File metadata

  • Download URL: rubiko-1.0.6.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rubiko-1.0.6.tar.gz
Algorithm Hash digest
SHA256 f03a7cb2cb056fc8cba68c9f651fea03fabd10164fb5f00b95333139eaaf786a
MD5 29c57417e6230cb07b90cfcf84b246ee
BLAKE2b-256 9ba23fd1ac40b4f2088a5bb908588cbea54685dd12ce0e8708dc233bba9cca56

See more details on using hashes here.

File details

Details for the file rubiko-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: rubiko-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rubiko-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 66db848fc9cf67e83dc8d8d6da212d574cd6be3492aefbf9a28b7225946c78fa
MD5 c6020771b2a86e96d2709cbb8c520e4b
BLAKE2b-256 9e7999fe8427252675772ff0426858f3850d80d684918ee20857e5dfadff123a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page