我有一个代码简单的电报回声机器人。
import config
import telebot
bot = telebot.TeleBot(config.token)
@bot.message_handler(content_types=["text"])
def repeat_all_messages(message):
bot.send_message(message.chat.id, message.text)
if __name__ == '__main__':
bot.polling(none_stop=True)
Run Code Online (Sandbox Code Playgroud)
但我想要机器人将收到的消息作为转发发送到另一个聊天。我试过以下方式
chat = '187458737'
bot.forward_message(chat, message.chat.id, message.text)
Run Code Online (Sandbox Code Playgroud)
但它并没有导致成功。我应该如何修改我的机器人?
我正在使用 Siri 与电报的集成。我可以要求 Siri 使用电报向任何人发送消息,它会这样做。但是,如果我要求它使用 botname 向机器人发送消息,它会不断询问向谁发送消息,并且不选择向谁发送消息的机器人名称。
工作:“电报人名嗨”
不工作:“Telegram botname Hi”
这是否会发生,任何想法如何让它发挥作用。
我正在使用以下设置进行测试:我有一个禁用隐私模式的机器人,因此它会侦听频道中的所有消息。我在 Bot Framework 中设置了一个 webhook,用于打印所有传入的消息。我首先在 Telegram 网络上注意到了这个问题,后来发现它也会影响 Android,只有当您手动输入提及时,您才不会收到通知——如果您从下拉列表中选择一个提及,则会发送通知。
这是我发送消息的频道的屏幕截图:
这是我从 webhook 得到的消息:
new message: this message sent from web will be relayed even if it contains the mention @jlarky
new message: @JLarkyTestBot you can mention the bot though
new message: ^^ last message from web
new message: Now message from Android
new message: Yarosla mentions work
new message: Yarosla it has to be from mention dropdown, otherwise it's not sent either
Run Code Online (Sandbox Code Playgroud)
如您所见,其中只有一部分已交付。
我在我的 Asp.Net 项目中使用 Telegram Bot Api 库(链接)(版本 13.0.1.0)。
我使用下代码将带有标题的图像发送到我的频道。
var sb = new StringBuilder();
sb.AppendLine("line1 ");
sb.AppendLine("line2 ");
sb.AppendLine("line3 ");
bot.SendPhotoAsync("@" + channel.Name, fileToSend, sb.ToString(), false, 0);
Run Code Online (Sandbox Code Playgroud)
但我的问题是我的换行符没有显示在输出中
如何解决这个问题并在输出中正确显示新行?
[解决了]
这是这个库的错误,升级到 13.2.0 问题解决了。
我正在使用电报机器人 API 来制作机器人。我有一些只能从管理员发送的命令。就像踢和禁止命令一样。如何检查发件人是否是管理员?我正在使用python-telegram-botapi。我不希望每个人都能够禁止成员。
如果我们可以将 WhatsApp 组连接到电报组并从 whatsapp 接收消息到电报,反之亦然,那就太好了。是否有任何机器人程序可以做到这一点。如何设置桥梁或类似的东西?
我一直在尝试创建一个电报机器人。我用 Python 编码,以下是我到目前为止所做的。
import logging
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
@app.route("/")
def start(bot, update):
help_text = 'text'
keyboard = [[InlineKeyboardButton("Button_1", url=('url'))]]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text(help_text, reply_markup=reply_markup)
def button(bot, update):
query = update.callback_query
bot.edit_message_text(text="Selected option: {}".format(query.data),
chat_id=query.message.chat_id,
message_id=query.message.message_id)
def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"', update, error)
def main():
updater = Updater(<TOKEN>)
updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CallbackQueryHandler(button))
updater.dispatcher.add_error_handler(error)
updater.start_polling()
updater.idle()
if __name__ == "__main__": …Run Code Online (Sandbox Code Playgroud) 我想知道是否存在每天向我发送 arXiv 文章的 Telegram 机器人?
我查了一下互联网,但我找不到。我需要它,因为基本上很难每天浏览 arXiv 和阅读新文章。我不确定这里是否是提出这个问题的最佳地点。如果我错了,很抱歉。谢谢。
是否可以使用电报机器人 api、php在 1 条消息中发送多个图像?我知道方法。sendPhoto()
就我阅读 Telegram Bot API 的文档而言,Telegram 不会以任何方式限制对您的 webhook 回调的调用。
我正在创建一个 Telegram Bot,它仅适用于我将列入白名单的组和频道。
我可以过滤掉我在 webhook 回调中收到的消息。但是,恶意用户可以将我的机器人添加到一千个大组中,并可能导致所有其他用户拒绝服务。
即使 Telegram 实施了一些速率限制,此类用户操作仍可能导致所有其他用户拒绝服务。
如何指定 Telegram 机器人可以添加到的组和频道。
security telegram telegram-bot php-telegram-bot telegram-webhook
telegram-bot ×10
telegram ×4
asp.net ×1
botframework ×1
bots ×1
c# ×1
php ×1
python ×1
python-3.x ×1
security ×1
siri ×1
sirikit ×1
whatsapp ×1