本文整理汇总了Python中telegram.ReplyKeyboardRemove方法的典型用法代码示例。如果您正苦于以下问题:Python telegram.ReplyKeyboardRemove方法的具体用法?Python telegram.ReplyKeyboardRemove怎么用?Python telegram.ReplyKeyboardRemove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类telegram
的用法示例。
在下文中一共展示了telegram.ReplyKeyboardRemove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: inevidenza
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def inevidenza(bot, update):
"""Defining function that prints 5 news from in evidenza"""
news_to_string = ""
for i, item in enumerate(utils.NEWS['univaq'][0:5]):
news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n\n').format(**item)
news_to_string += ('<a href="http://www.univaq.it">'
'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
'restare sempre aggiornato')
bot.sendMessage(update.message.chat_id,
parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例2: discab_news
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def discab_news(bot, update, section):
"""Defining function that prints 5 news from discab given section"""
news_to_string = ""
for i, item in enumerate(utils.NEWS[section]):
news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n\n').format(**item)
news_to_string += ('<a href="http://discab.univaq.it/index.php?id=2004">'
'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
'restare sempre aggiornato')
bot.sendMessage(update.message.chat_id,
parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例3: send_to_developers
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def send_to_developers(bot, update):
"""Function to send feedback to developers"""
feedback_user = (('<b>{}</b>\n\n <i>{} {}, {}</i>')
.format(update.message.text,
update.message.from_user.first_name,
update.message.from_user.last_name,
update.message.chat_id))
for admin in os.environ['ADMIN'].split(' '):
bot.sendMessage(admin, feedback_user, parse_mode='HTML')
bot.sendMessage(update.message.chat_id, 'Grazie per la collaborazione, '
'il messaggio è stato inviato agli sviluppatori.',
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例4: paginate
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def paginate(bot, update, result):
markup = ReplyKeyboardRemove()
output = result.output
time1 = result.time
memory1 = result.memory
message1 = result.message
if time1 is not None:
time1 = time1[0]
if memory1 is not None:
memory1 = memory1[0]
if output is not None:
output = output[0]
else:
output = ""
if len(output) <= 2897:
update.message.reply_text("Output:\n" + str(output) + "\n" + "Time: " + str(time1) + "\nMemory: " + str(
memory1) + "\nMessage: " + str(message1), reply_markup=markup)
else:
with open("out.txt", "w") as text_file:
text_file.write("Output:\n" + str(output) + "\n" + "Time: " + str(time1) + "\nMemory: " + str(
memory1) + "\nMessage: " + str(message1))
bot.send_document(chat_id=update.message.chat_id, document=open('out.txt', 'rb'), reply_markup=markup)
os.remove('out.txt')
# FUNCTION TO CREATE XLSX FILES
示例5: send_message
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def send_message(self, msg, chat_id=None, reply_markup=None):
if not isinstance(msg, dict):
msg = {'text': msg}
if not msg['text']:
return
if len(msg['text']) > self.MAX_LENGTH_MESSAGE:
msg['text'] = msg['text'][:self.MAX_LENGTH_MESSAGE - 3] + '...'
msg['chat_id'] = chat_id or self.from_id
msg['disable_web_page_preview'] = True
if reply_markup:
msg['reply_markup'] = reply_markup
if 'reply_markup' not in msg:
msg['reply_markup'] = telegram.ReplyKeyboardRemove()
if reply_markup is False or getattr(self, 'chat_type', None) == 'channel':
msg.pop('reply_markup', None)
try:
ret = self.sendMessage(parse_mode='Markdown', **msg)
except Exception:
self.logger.error('Exception send message = %s' % msg)
ret = self.sendMessage(**msg)
return ret
示例6: destroy_app
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def destroy_app(self, bot, update, user_data):
if user_data.get('job'):
user_data.pop('job').schedule_removal()
# end if
if user_data.get('app'):
app = user_data.pop('app')
app.destroy()
# remove output path
#shutil.rmtree(app.output_path, ignore_errors=True)
# end if
update.message.reply_text(
'Session closed',
reply_markup=ReplyKeyboardRemove()
)
return ConversationHandler.END
# end def
示例7: handle_delete_cache
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def handle_delete_cache(self, bot, update, user_data):
app = user_data.get('app')
user = update.message.from_user
text = update.message.text
if text.startswith('No'):
if os.path.exists(app.output_path):
shutil.rmtree(app.output_path, ignore_errors=True)
os.makedirs(app.output_path, exist_ok=True)
# end if
# end if
# Get chapter range
update.message.reply_text(
'%d volumes and %d chapters found.' % (
len(app.crawler.volumes),
len(app.crawler.chapters)
),
reply_markup=ReplyKeyboardRemove()
)
return self.display_range_selection_help(bot, update)
# end def
示例8: resend
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def resend(bot, update: Update, user, render):
tasks.send_confirmation_mail.delay(user.pk)
update.message.reply_text(text=render('confirmation_message_is_sent'), reply_markup=ReplyKeyboardRemove())
示例9: reset_email
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def reset_email(bot, update: Update, user, render):
user.email = None
user.is_confirmed = False
user.save()
update.message.reply_text(text=render('email_is_reset'), reply_markup=ReplyKeyboardRemove())
示例10: close
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def close(bot, update):
"""Defining Function for remove keyboard"""
bot.sendMessage(update.message.chat_id,
'Ho chiuso le news!',
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例11: disim
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def disim(bot, update):
"""Defining the command to retrieve 5 news
Now we store the last 10 news into the database,
the comparison to send notifications is made between
the last 5 pulled news from disim site and the news stored into the db.
This decision was made to avoid repeated news, in fact, if some news(from first to fifth)
is deleted the sixth(that now has become the fifth) news will be sent again even if it is
already been sent in the past because it will appear in the pulled news and it
is no more present into the database at the moment of the comparison.
"""
news_to_string = ""
for i, item in enumerate(utils.NEWS['disim'][0:5]):
suffix = '...' if len(item['description']) > 75 else ''
news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n'
'\t<i>{description:.75}{}</i>\n\n').format(suffix, **item)
news_to_string += ('<a href="http://www.disim.univaq.it/main/news.php?entrant=1">'
'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
'restare sempre aggiornato')
bot.sendMessage(update.message.chat_id,
parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例12: disimon
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def disimon(bot, update):
"""Defining the command to enable notification for disim"""
if update.message.chat_id not in utils.USERS['disim']:
utils.subscribe_user(update.message.chat_id, 'disim')
bot.sendMessage(update.message.chat_id,
text='Notifiche Abilitate!',
reply_markup=telegram.ReplyKeyboardRemove())
else:
bot.sendMessage(update.message.chat_id,
text='Le notifiche sono già abilitate!',
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例13: disimoff
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def disimoff(bot, update):
"""Defining the command to disable notification for disim"""
if update.message.chat_id in utils.USERS['disim']:
utils.unsubscribe_user(update.message.chat_id, 'disim')
bot.sendMessage(update.message.chat_id,
text='Notifiche Disattivate!',
reply_markup=telegram.ReplyKeyboardRemove())
else:
bot.sendMessage(update.message.chat_id,
text='Per disattivare le notifiche dovresti prima attivarle.',
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例14: univaqon
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def univaqon(bot, update):
"""Defining the command to enable notification for univaq"""
if update.message.chat_id not in utils.USERS['univaq']:
utils.subscribe_user(update.message.chat_id, 'univaq')
bot.sendMessage(update.message.chat_id,
text='Notifiche Abilitate!',
reply_markup=telegram.ReplyKeyboardRemove())
else:
bot.sendMessage(update.message.chat_id,
text='Le notifiche sono già abilitate!',
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END
示例15: univaqoff
# 需要导入模块: import telegram [as 别名]
# 或者: from telegram import ReplyKeyboardRemove [as 别名]
def univaqoff(bot, update):
"""Defining the command to disable notification for univaq"""
if update.message.chat_id in utils.USERS['univaq']:
utils.unsubscribe_user(update.message.chat_id, 'univaq')
bot.sendMessage(update.message.chat_id,
text='Notifiche Disattivate!',
reply_markup=telegram.ReplyKeyboardRemove())
else:
bot.sendMessage(update.message.chat_id,
text='Per disattivare le notifiche dovresti prima attivarle.',
reply_markup=telegram.ReplyKeyboardRemove())
return ConversationHandler.END