🟢 متود sendContact:
chat_id ==> int | str
phone_number ==> str
first_name ==> str
last_name ==> str
reply_to_message_id ==> int
reply_markup ==> list
🟡 نکته: async\await
await bot.send_contact(chat_id=chat_id, phone_number=phone_number, first_name=first_name, last_name=last_name)#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #ارسال_مخاطب
۱۹۳
۰:۴۶
🟢 متود sendLocation:
chat_id ==> int | str
latitude ==> float
longitude ==> float
reply_to_message_id ==> int
reply_markup ==> list
🟡 نکته: async\await
await bot.send_location(chat_id=chat_id, latitude=latitude, longitude=longitude)#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #ارسال_موقعیت
۲۰۱
۰:۴۶
🟢 متود sendVoice:
chat_id ==> int | str
voice ==> str
caption ==> str
reply_to_message_id ==> int
reply_markup ==> list
🟡 نکته: async\await
await bot.send_voice(chat_id=chat_id, voice=voice)#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #ارسال_ضبط
۲۰۱
۱۴:۴۹
🟢 متود sendAudio:
chat_id ==> int | str
audio ==> str
caption ==> str
reply_to_message_id ==> int
reply_markup ==> list
🟡 نکته: async\await
await bot.send_audio(chat_id=chat_id, audio=audio)#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #ارسال_موسیقی
۲۱۲
۱۴:۵۰
🟢 ربات Echo:
message ==> text ==> message.text
message ==> reply_text ==> message.reply_text()
🟡 نکته: async\await
from balecore import Bot, Filters
bot = Bot(token="TOKEN", url="https://tapi.bale.ai")
filters = Filters(bot)
@bot.Message()
async def echo(bot, update, message):
await message.reply_text(message.text)
bot.start
#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #ربات_اکو
۱۹۵
۱۷:۵۰
🟢 نصب کتابخانه:
pip install -U balecore
pip install balecore
pip install -e https://mirror-pypi.runflare.com/simple balecore
sudo pip install balecore
#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #نصب_کتابخانه
۱۹۴
۱۷:۵۴
🟢 اجرای ربات:
بدون asyncio:
bot.startبا asyncio:
import asyncio
asyncio.run(bot.start_polling)#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #اجرای_ربات
۲۰۱
۱۸:۵۷
🟢 آموزش Bot:
token ==> strurl ==> str ==> https://tapi.bale.aiproxy ==> str ==> Noneinfo_file_path ==> JSON ==> info.jsonconcurrency_limit ==> int ==> 100
bot = Bot(token="TOKEN")#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #آموزش_Bot
۲۳۱
۱۹:۰۲
🟢 ربات ReplyKeyboardMarkup:
from balecore import Bot, Filters, ReplyKeyboardMarkup, ReplyKeyboardButton
bot = Bot(token="")
filters = Filters(bot)
@bot.Message(filters.private & filters.command("start")
async def reply_keyboard(bot, update, message):
chat_id = message.chat.id
keyboard = ReplyKeyboardMarkup()
keyboard.add_row(ReplyKeyboardButton(text="button 1"), ReplyKeyboardButton(text="button 2"))
keyboard.add_row(ReplyKeyboardButton(text="button 3"))
await bot.send_message(chat_id=chat_id, text="Hello, balecore!", reply_markup=keyboard)
bot.start#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #آموزش_ریپلای_کیبورد
۲۲۲
۱۸:۲۲
🟢 ربات InlineKeyboardMarkup:
from balecore import Bot, Filters, InlineKeyboardButton, InlineKeyboardMarkup
bot = Bot(token="")
filters = Filters(bot)
@bot.Message(filters.private & filters.command("start")
async def reply_keyboard(bot, update, message):
chat_id = message.chat.id
keyboard = InlineKeyboardMarkup()
keyboard.add_row(InlineKeyboardButton("button 1", "button1"), InlineKeyboardButton("button 2", "button2"))
keyboard.add_row(InlineKeyboardButton("button 3", "button3"))
await bot.semd_message(chat_id=chat_id, text="Hello, balecore!", reply_markup=keyboard)
@bot.CallbackQuery()
async def callback_query(bot, update, message):
callback_query.message.bot = bot
data = callback_query.data
if data == "button1":
await callback_query.message("it,s button 1")
elif data == "button2":
await callback_query.message("it,s button 2")
elif data == "button3":
await callback_query.message("it,s button 3")
bot.start#BaleCore #ربات_بله #آموزش_پایتون #برنامه_نویسی #آموزش_آینلاین_کیبورد
۲۶۳
۱۹:۰۹