telegram-bot

python telebot got unexpected response

无人久伴 提交于 2020-08-22 19:08:11
问题 I have been using my Telegram bot for sending me different notifications from my desktop computer using python's telebot library. Everything was working properly for quite a long time, but one day it stopped working. Here's the code (Python 2.7): import telebot import socket TELEBOT_TOKEN = '<token>' CHAT_ID = <chat id> bot = telebot.TeleBot(TELEBOT_TOKEN) def notify(message): bot.send_message(CHAT_ID, 'Notification from ' + socket.gethostname() + ':\n' + message) notify('Hello world!') When

“Cannot perform reduce with flexible type” in Image Processing

回眸只為那壹抹淺笑 提交于 2020-07-23 08:27:26
问题 I have a problem. The main task is to create a bot in a telegram, which, when a photo is loaded into it, will change the contrast of the image. The main condition is the addition of the so-called black and white dots. Their principle is to search for the lightest point, the darkest and maximum values at these points.Just the code (working, checking) looks something like this (used numpy and PIL). from PIL import Image import numpy as np image = Image.open('example1.jpg') arr = np.asarray

“Cannot perform reduce with flexible type” in Image Processing

浪尽此生 提交于 2020-07-23 08:26:05
问题 I have a problem. The main task is to create a bot in a telegram, which, when a photo is loaded into it, will change the contrast of the image. The main condition is the addition of the so-called black and white dots. Their principle is to search for the lightest point, the darkest and maximum values at these points.Just the code (working, checking) looks something like this (used numpy and PIL). from PIL import Image import numpy as np image = Image.open('example1.jpg') arr = np.asarray

“Cannot perform reduce with flexible type” in Image Processing

雨燕双飞 提交于 2020-07-23 08:25:06
问题 I have a problem. The main task is to create a bot in a telegram, which, when a photo is loaded into it, will change the contrast of the image. The main condition is the addition of the so-called black and white dots. Their principle is to search for the lightest point, the darkest and maximum values at these points.Just the code (working, checking) looks something like this (used numpy and PIL). from PIL import Image import numpy as np image = Image.open('example1.jpg') arr = np.asarray

Using HTML in Telegram bot

梦想与她 提交于 2020-07-20 08:29:29
问题 This is not a duplicated question. I want to use html codes in my telegram bot that is written by c#. I searched in SO but I did not find any answer. How to do that? I used TelegramBotSharp. Here is my code related to the part that I explained: MessageTarget target = (MessageTarget)update.Chat ?? update.From; if(Text.StartsWith("Hello")) { bot.SendMessage(target, "Hello <a href='http://google.com'> dear</a>", true); } 回答1: Use the following syntax in your message: *bold text* _italic text_

Why cannot I receive any POST request on my Telegram bot written with Flask (Python)?

北慕城南 提交于 2020-07-07 07:19:14
问题 I don't want to use getUpdates method to retrieve updates from Telegram, but a webhook instead. Error from getWebhookInfo is: has_custom_certificate: false, pending_update_count: 20, last_error_date: 1591888018, last_error_message: "SSL error {error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed}" My code is: from flask import Flask from flask import request from flask import Response app = Flask(__name__) @app.route('/', methods=['POST', 'GET']) def bot(): if

Why cannot I receive any POST request on my Telegram bot written with Flask (Python)?

a 夏天 提交于 2020-07-07 07:18:25
问题 I don't want to use getUpdates method to retrieve updates from Telegram, but a webhook instead. Error from getWebhookInfo is: has_custom_certificate: false, pending_update_count: 20, last_error_date: 1591888018, last_error_message: "SSL error {error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed}" My code is: from flask import Flask from flask import request from flask import Response app = Flask(__name__) @app.route('/', methods=['POST', 'GET']) def bot(): if

(python) Telegram bot- how to send messages periodically?

北城余情 提交于 2020-07-06 12:58:47
问题 I have a dilemma regarding my telegram bot. Let's say I have to create a function that will ask, every user connected to the bot, one time per week/month, a question: def check_the_week(bot, update): reply_keyboard = [['YES', 'NO']] bot.send_message( chat_id=update.message.chat_id, text=report, reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)) # sends the total nr of hours update.reply_text("Did you report all you working hour on freshdesk for this week?",

Telegram Bot in ASP.Net Web Form

≯℡__Kan透↙ 提交于 2020-06-29 03:42:30
问题 I have this "Net Core Console App" code for Telegram Bot class Program { private static readonly TelegramBotClient bot = new TelegramBotClient(MyToken); static void Main(string[] args) { bot.OnMessage += tgramBotTestMSG; bot.StartReceiving(); Console.ReadLine(); bot.StopReceiving(); } private static void tgramBotTestMSG(object sender, MessageEventArgs e) { if (e.Message.Type == Telegram.Bot.Types.Enums.MessageType.Text) PrepareQuestionnaires(e); } public static void PrepareQuestionnaires

Telegram bot- how to send messages Daily

纵然是瞬间 提交于 2020-06-28 09:53:36
问题 I am trying to develop a telegram-bot that send a message every day at a specific time. but it's not working for me. I think the problem is in the time parameter. I used another method of this class and they were working well but run_daily is not working. :( import telegram.ext from telegram.ext import Updater from datetime import time updater = Updater('My Token', use_context=True) job = updater.job_queue def callback_minute(context: telegram.ext.CallbackContext): context.bot.send_message