私はコマンド/ defineを見た後に、その単語を尋ねるテレグラムボットを作りたいと思っています。 ボットから要求された後にユーザーが送信した単語を抽出したいとします。どうすればいいのですか?テレグラムのPython APIを使用して1つのメッセージを取得しますか?
import telegram
from telegram.ext import Updater
from telegram.ext import MessageHandler, Filters
from telegram.ext import CommandHandler
updater = Updater(token='******************')
dispatcher = updater.dispatcher
def define(bot, update):
bot.send_message(chat_id=update.message.chat_id, text="Enter word")
word = '''get content of following message'''
definition = get_definition(word)
bot.send_message(chat_id=update.message.chat_id, text=definiton)
definition_handler = CommandHandler('define', define)
dispatcher.add_handler(definition_handler)
updater.start_polling()
これまでのコードは試しましたか? –
あなたの質問は広くなっていますので、お読みください[質問する](https://stackoverflow.com/help/how-to-ask) – eyllanesc
@Sharad Bhat見逃している質問がいくつか掲載されています、完全で検証可能な例](https://stackoverflow.com/help/mcve)を参照してください。質問をして必要な回答を得る能力を高めるために、[質問のガイドライン](https://stackoverflow.com/help/on-topic)をご覧ください。また、[低品質の質問が多すぎる](https://stackoverflow.com/help/quality-standards-error)が表示された場合、アカウントには質問を禁止することができます。よく聞かれる質問は、より良い答えを引き付ける傾向があります。がんばろう! –