Skip to content

Instantly share code, notes, and snippets.

@mhnabi
Created December 15, 2016 17:15
Show Gist options
  • Save mhnabi/dcc54b66b68cbbc0f9fbbf9951fce463 to your computer and use it in GitHub Desktop.
Save mhnabi/dcc54b66b68cbbc0f9fbbf9951fce463 to your computer and use it in GitHub Desktop.
import telebot
import logging
from telebot import types
from flask import Flask, request
bot= telebot.TeleBot("313815443:AAE75E033KLgqwAZ_wJxwUFNO8mK6JXNO-8")
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
reply = message.from_user.id if not None else ''
name = message.from_user.username if not None else ''
fname = message.from_user.first_name
lname = message.from_user.last_name if not None else ''
chat1 = message.chat.id if not None else ''
payam = " سلام "+str(name)
bot.reply_to(message,payam)
@bot.message_handler(commands=['startgame'])
def send_welcomee(message):
chat_id = message.chat.id
# markup = types.InlineKeyboardMarkup()
# markup.add(types.InlineKeyboardButton('Play game', url='http://simorgh.foxinia.ir'))
bot.send_game(chat_id, "Calc1")
@bot.callback_query_handler(func=lambda call: True)
def button_callback(call):
user_id = call.from_user.id
inline_message_id = call.inline_message_id
game = "http://simorgh.foxinia.ir/?id=" + str(user_id) + "&m=" + str(inline_message_id)
bot.answer_callback_query(call.id, text='Enjoy The Game!',url=game,show_alert=False)
#bot.set_webhook("http://"+IP+":"+PORT+"/"+API_TOKEN)
logger = telebot.logger
telebot.logger.setLevel(logging.DEBUG)
bot.polling(none_stop=False, interval=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment