基本上我試圖理解這個api是如何工作的,通過執行以下操作我無法將消息傳遞到我的頻道(我'從我的電報賬戶發送/測試命令)。另外,我如何使用JobQueue並每隔3小時發送一次自動消息,例如?文檔說明不適用於我。使用電報bot api,python 3和JobQueue發送消息的方法
def test(bot, update):
update.send_message(chat_id='@channelid', text='this is a test')
def main():
# Create the EventHandler and pass it your bot's token.
updater = Updater("457160310:AAFlxrH2uAaOMGrgO0suOXFM2gVKywsUL0E")
dp = updater.dispatcher
dp.add_handler(CommandHandler("test", test))
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
請注意,你添加了令牌。如果它仍然有效,請考慮通過@botfather – 91DarioDev