Skip to content

Instantly share code, notes, and snippets.

@mhnabi
Created December 14, 2016 20:26
Show Gist options
  • Save mhnabi/c3626d7a4b85e7ea01a0f7aeb4b2f891 to your computer and use it in GitHub Desktop.
Save mhnabi/c3626d7a4b85e7ea01a0f7aeb4b2f891 to your computer and use it in GitHub Desktop.
import telebot
import logging
from telebot import types
with open ("key.txt", "r") as key:
token = key.read().strip()
API_TOKEN = token
bot= telebot.TeleBot(API_TOKEN)
@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',callback_game=True))
bot.send_game(chat_id, "Calc1", disable_notification=None,reply_to_message_id=chat_id ,reply_markup=markup)
bot.send_message(chat_id, 'playgame', disable_notification=True, reply_markup=markup)
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