From fe3c057bc6e70125d34a1026e58a84c8b0c0fed2 Mon Sep 17 00:00:00 2001 From: JungDev Date: Wed, 27 Jul 2016 17:36:20 +0200 Subject: [PATCH] delete backup file --- example/telegrambot.py~ | 46 ----------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 example/telegrambot.py~ diff --git a/example/telegrambot.py~ b/example/telegrambot.py~ deleted file mode 100644 index a44a99b..0000000 --- a/example/telegrambot.py~ +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Example code for telegrambot.py module -from telegram.ext import CommandHandler, MessageHandler, Filters -from django_telegrambot.apps import DjangoTelegramBot - -import logging -logger = logging.getLogger(__name__) - - -# Define a few command handlers. These usually take the two arguments bot and -# update. Error handlers also receive the raised TelegramError object in error. -def start(bot, update): - bot.sendMessage(update.message.chat_id, text='Hi!') - - -def help(bot, update): - bot.sendMessage(update.message.chat_id, text='Help!') - - -def echo(bot, update): - bot.sendMessage(update.message.chat_id, text=update.message.text) - - -def error(bot, update, error): - logger.warn('Update "%s" caused error "%s"' % (update, error)) - - -def main(): - logger.info("Loading handlers for telegram bot") - - # Default dispatcher (this is related to the first bot in settings.TELEGRAM_BOT_TOKENS) - dp = DjangoTelegramBot.dispatcher - # To get Dispatcher related to a specific bot - # dp = DjangoTelegramBot.getDispatcher('BOT_n_token') #get by bot token - # dp = DjangoTelegramBot.getDispatcher('BOT_n_username') #get by bot username - - # on different commands - answer in Telegram - dp.addHandler(CommandHandler("start", start)) - dp.addHandler(CommandHandler("help", help)) - - # on noncommand i.e message - echo the message on Telegram - dp.addHandler(MessageHandler([Filters.text], echo)) - - # log all errors - dp.addErrorHandler(error) -