Created
July 20, 2016 13:14
-
-
Save JosXa/d67a80c219bdcaf266d7b1fd66539ad5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import json | |
#import ast | |
import os | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
from telegram import ReplyKeyboardMarkup | |
#from telegram.ext import Updater, CommandHandler, MessageHandler, Filters | |
from telegram.ext import Updater, CommandHandler, MessageHandler, \ | |
CallbackQueryHandler, Filters | |
from telegram import Emoji, ForceReply, InlineKeyboardButton, \ | |
InlineKeyboardMarkup | |
updater = Updater(token='203417369:AAHRyuXPU8qWIPRZ3fOCYbyiJAGTuesnKyM') | |
# token Pierre: 203417369:AAHRyuXPU8qWIPRZ3fOCYbyiJAGTuesnKyM | |
#token weebi: 184402758:AAH05uyyl0gCNSb77qM4XCGfC6F605RTlmk | |
#token :212403766:AAFEHWnlTB9e_GfHcITpIHIzu_eiGEYo9Cg | |
dispatcher = updater.dispatcher | |
try: | |
YES, NO = (Emoji.THUMBS_UP_SIGN.decode('utf-8'), Emoji.THUMBS_DOWN_SIGN.decode('utf-8')) | |
except AttributeError: | |
YES, NO = (Emoji.THUMBS_UP_SIGN, Emoji.THUMBS_DOWN_SIGN) | |
from telegram.ext import Updater | |
dispatcher = updater.dispatcher | |
def echo(bot, update): | |
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('Solde',callback_data='Solde'),InlineKeyboardButton('Evolution des soldes', callback_data='Evolution des soldes'),InlineKeyboardButton('Produits vendus', callback_data='Produits vendus')]]) | |
bot.sendMessage(chat_id=update.message.chat_id, text="Bienvenue!", reply_markup=reply_markup) | |
def inlinekey(bot, update): | |
query = update.callback_query | |
chat_id = query.message.chat_id | |
user_id = query.from_user.id | |
text = query.data | |
if text == "Solde": | |
bot.sendPhoto(photo=open(str(update.message.text)+"ZZ"+".png", | |
chat_id=chat_id, | |
message_id=query.message.message_id) | |
from telegram.ext import MessageHandler, Filters | |
#rt0=MessageHandler([Filters.document], echo) | |
#dispatcher.add_handler(rt0) | |
unknown_handler = CommandHandler('start', echo) | |
dispatcher.add_handler(unknown_handler) | |
echo_handler1 = CallbackQueryHandler(inlinekey) | |
dispatcher.add_handler(echo_handler1) | |
#echo_handler11 = CallbackQueryHandler(ess) | |
#dispatcher.add_handler(echo_handler11) | |
#unknown_handler01 = CommandHandler('start', inlinekey) | |
#dispatcher.add_handler(unknown_handler01) | |
echo_handler0 = MessageHandler([Filters.text], echos) | |
dispatcher.add_handler(echo_handler0) | |
rt0=MessageHandler([Filters.document], echos) | |
dispatcher.add_handler(rt0) | |
updater.start_polling() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment