|
@@ -14,10 +14,8 @@ def ping(bot, update):
|
|
|
try:
|
|
|
sp.check_output(['ping', '-c', '1', 'lcm.mi.infn.it'])
|
|
|
except CalledProcessError, e:
|
|
|
- bot.send_message(chat_id=update.message.chat_id,
|
|
|
- text='LCM is unreachable')
|
|
|
- bot.send_message(chat_id=update.message.chat_id,
|
|
|
- text='LCM is reachable')
|
|
|
+ update.message.reply_text(text='LCM is unreachable')
|
|
|
+ update.message.reply_text(text='LCM is reachable')
|
|
|
|
|
|
|
|
|
def is_web_up(bot, update):
|
|
@@ -26,25 +24,21 @@ def is_web_up(bot, update):
|
|
|
conn = httplib.HTTPConnection('lcm.mi.infn.it:443')
|
|
|
conn.request('HEAD', '/')
|
|
|
s = conn.getresponse().status
|
|
|
- bot.send_message(chat_id=update.message.chat_id,
|
|
|
- text='Web server replied with code %s ' % s)
|
|
|
+ update.message.reply_text(text='Web server replied with code %s ' % s)
|
|
|
except StandardError:
|
|
|
- bot.send_message(chat_id=update.message.chat_id,
|
|
|
- text='An error occurred while connecting')
|
|
|
+ update.message.reply_text(text='An error occurred while connecting')
|
|
|
|
|
|
|
|
|
def vietnam(bot, update):
|
|
|
"""Spout wise words"""
|
|
|
- bot.send_message(chat_id=update.message.chat_id,
|
|
|
- text='Ricordate, ragazzi, LCM è come il Vietnam. Una volta \
|
|
|
-entrati, è impossibile uscirne!')
|
|
|
+ update.message.reply_text(text='Ricordate, ragazzi, LCM è come il Vietnam.'
|
|
|
+ 'Una volta entrati, è impossibile uscirne!')
|
|
|
|
|
|
|
|
|
def sell_your_mother(bot, update):
|
|
|
"""Remind people not to disclose passwords"""
|
|
|
pic_id = 'AgADBAADbasxG9JPlAQNlEW3ML5sk_bEXxkABHKAFZ1ZzBZsNvMBAAEC'
|
|
|
- bot.sendPhoto(chat_id=update.message.chat_id, photo=pic_id,
|
|
|
- caption='cit. Mandelli')
|
|
|
+ update.message.reply_photo(photo=pic_id, caption='cit. Mandelli')
|
|
|
|
|
|
|
|
|
def print_msg_info(bot, update):
|
|
@@ -62,4 +56,4 @@ def error(bot, update, error):
|
|
|
def abuse_150(bot, update):
|
|
|
"""Verbally abuse incompetent LCM collaborators"""
|
|
|
insult = np.random.choice(insults)
|
|
|
- bot.send_message(chat_id=update.message.chat_id, text=insult)
|
|
|
+ update.message.reply_text(text=insult)
|