非正式电报bot api库和客户端

twx.botapi的Python项目详细描述


twx.botapi

twx.bot api:非正式电报bot api库和客户端

--
contributionsPlease join https://github.com/datamachine/twx.botapi
issuesPlease use https://github.com/datamachine/twx.botapi/issues
Python version supported2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6

twx.bot api是用于电报bot api的python接口。它支持 进行同步和异步调用并将响应转换为 可用的本机python对象。

对mtproto api的支持正在进行中,但现在被认为是pre-alpha。

支架

您可以在以下位置加入我们的支持聊天:https://telegram.me/twxapi

安装

对于稳定:

pip install twx.botapi

对于dev:

pip install -i https://testpypi.python.org/pypi twx.botapi

文档

文档可以在http://pythonhosted.org/twx.botapi/

快速启动

fromtwx.botapiimportTelegramBot,ReplyKeyboardMarkup"""Setup the bot"""bot=TelegramBot('<API TOKEN>')bot.update_bot_info().wait()print(bot.username)"""Send a message to a user"""user_id=int(<someuserid>)result=bot.send_message(user_id,'test message body').wait()print(result)"""Get updates sent to the bot"""updates=bot.get_updates().wait()forupdateinupdates:print(update)"""Use a custom keyboard"""keyboard=[['7','8','9'],['4','5','6'],['1','2','3'],['0']]reply_markup=ReplyKeyboardMarkup.create(keyboard)bot.send_message(user_id,'please enter a number',reply_markup=reply_markup).wait()

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java无法启动应用程序:JNLP错误   java根据用户输入在PreparedStatement中使用setTime()或setNull()   java EJB与同步   java以object为键通过hashmap进行搜索   java中的模10^9+7   针对包含其他对象的对象的java OOP最佳实践   如何将字符串作为HTML代码从Java文件读取到JSP页面?   java我的POM怎么了?“解析表达式..检测到递归表达式循环”   用于Hbase的Mapreduce的java NoSuchMethodError   JAVAlang.SecurityException:权限拒绝:启动意图{act=安卓.Intent.action.MAIN cat=[安卓.Intent.category.LAUNCHER]   数组初始化谜语Java   通过arraylist搜索时的java句柄关联