PYTHON_WITH_MOHAMMAD Telegram 103
مرحله ۴: دریافت نام شهر از کاربر
حالا می‌خوایم باتمون بتونه نام شهر رو از کاربر دریافت کنه. برای این کار از MessageHandler استفاده می‌کنیم.

from telegram.ext import MessageHandler, Filters

def get_city(update: Update, context: CallbackContext):
city = update.message.text
update.message.reply_text(f'شهر شما: {city}. در حال دریافت اطلاعات آب‌وهوا...')
# در مرحله بعدی، اطلاعات آب‌وهوا رو دریافت می‌کنیم

dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, get_city))



tgoop.com/python_with_mohammad/103
Create:
Last Update:

مرحله ۴: دریافت نام شهر از کاربر
حالا می‌خوایم باتمون بتونه نام شهر رو از کاربر دریافت کنه. برای این کار از MessageHandler استفاده می‌کنیم.


from telegram.ext import MessageHandler, Filters

def get_city(update: Update, context: CallbackContext):
city = update.message.text
update.message.reply_text(f'شهر شما: {city}. در حال دریافت اطلاعات آب‌وهوا...')
# در مرحله بعدی، اطلاعات آب‌وهوا رو دریافت می‌کنیم

dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, get_city))

BY آموزش پایتون و برنامه نویسی


Share with your friend now:
tgoop.com/python_with_mohammad/103

View MORE
Open in Telegram


Telegram News

Date: |

Users are more open to new information on workdays rather than weekends. Telegram iOS app: In the “Chats” tab, click the new message icon in the right upper corner. Select “New Channel.” How to Create a Private or Public Channel on Telegram? Private channels are only accessible to subscribers and don’t appear in public searches. To join a private channel, you need to receive a link from the owner (administrator). A private channel is an excellent solution for companies and teams. You can also use this type of channel to write down personal notes, reflections, etc. By the way, you can make your private channel public at any moment. Over 33,000 people sent out over 1,000 doxxing messages in the group. Although the administrators tried to delete all of the messages, the posting speed was far too much for them to keep up.
from us


Telegram آموزش پایتون و برنامه نویسی
FROM American