嗨,我想在我的电报机器人上创建按钮,这取决于‘洛杉矶’,‘纽约’。我对python有问题,当我在循环中插入它时,json只得到最后一个元素(纽约)。有人能解释我为什么吗?
import json
import time
from pprint import pprint
import telepot
from telepot.loop import MessageLoop
bot = telepot.Bot("token")
lista = ["Los Angeles","New York"]
for i in lista:
dic
我正在用python-telepot做一个电报机器人,我想用ReplyKeyboardMarkup创建一个键盘,这个键盘有输入我想要推导的数学表达式的功能(应用导数函数)我给你看键盘代码: if data == 'resol_der':
bot.answerCallbackQuery(query_id, text='Use the keyboard to insert')
markup = ReplyKeyboardMarkup(
keyboard=[
[KeyboardButton(te
我需要我的机器人来监控我的树莓cpu温度。它每分钟检查一次,然后如果>阈值,则发送警报。当一条消息被发送时,我需要它在10分钟内不再发送。我已经这样做了,但是在10分钟后发送相同的消息时,我得到了一个超时错误。有人能帮我吗?我在telepot giyhub页面上找不到任何帮助。
这是我的代码
bot = telepot.Bot(TOKEN)
bot.message_loop(handle)
while 1:
if ((get_cpu_temperature() > 30.0) and alarm()):
data = "Temperature:
我为电报组创建了一个机器人,但是每当有人发送民意测验时,这个错误就会一次又一次出现。
不断出错的API消息:
{"update_id":869921319,
"poll":{"id":"5427146762856956026","question":"[4/10] Qui \u00e9tait le ma\u00eetre de Grey","options":[{"text":"Oul","voter_count":6},{"
我想把我的机器人和另一个人的整个谈话转发给我自己。
这是我的密码:
import telepot
bot = telepot.Bot('<Token>')
def handle(msg):
my_id = 123456789 # this is my id for example
chat_id = telepot.glance(msg)[2]
bot_msg = bot.sendMessage(chat_id, 'this message is sent by bot')
bot.forwardMessage(
我是Python和Telegram机器人的新手,希望你能用一个简单的例子帮助我理解这一点。我需要的是定义一个方法,该方法返回一个字符串来完成一个url。在Python中,我需要的是:
user = input("Insert a username to see the graph:")
graphUrl = "https://www.graphsss123.com/ser/graph/" + user + "-123.jpg"
print(graphUrl)
我如何才能使用Telepot获得相同的结果?
谢谢
我正在使用telepot模块创建一个使用python的电报机器人。我需要获取传出消息的消息Id,以便能够检查用户是否会回复该消息。下面这段代码阐明了我想要做的事情:
import telepot
bot = telepot.Bot('Some Token')
def handle(msg):
chat_id = msg['chat']['id']
message_id = msg['message_id'] # I can get Id of incoming messages
因此,我一直在尝试使用python脚本通过telegram bot监控我的RDP服务器,但出现了一个问题。该程序无法访问屏幕截图输出文件夹,因此机器人无法发送屏幕截图。由于编译器给了我Errno13权限拒绝(click here to see the error),我认为问题出在权限上。我尝试使用Icacls /grant命令授予我的RDP用户访问该文件夹的权限,以管理员身份运行编译器,还通过属性手动编辑输出文件夹权限,但似乎什么都不起作用。 下面是我的代码: import sys
import time
import telepot
import pyautogui
from telepo
这是我的代码,我的conf.py文件就是我仔细检查过的API令牌和时区。我正在尝试让我的机器人通过发送消息或照片来响应按钮点击。我知道我需要使用sendPhoto函数,但我不知道如何在回调中激活它
import sys
import time
import os
import telepot
from telepot.loop import MessageLoop
from telepot.namedtuple import InlineKeyboardMarkup, InlineKeyboardButton
from telepot.delegate import (
per_cha
在我的研究中,我想使用一个电报机器人在每天的特定时刻向我实验中的35名志愿者的个人智能手机发出4个简单的多项选择题。我已经检查了telepot文档和示例,但我不能构建一个好的解决方案。测验示例很接近,但问题和答案应该对我的志愿者可见,并写入一个简单的日志文件以供进一步分析。
这是我修改过的quiz.py版本
import sys
import time
import random
import telepot
import telepot.helper
from telepot.loop import MessageLoop
from telepot.namedtuple import Inl