-
-
Save mhnabi/0bbafc218edf96f67a7d8c365ac2997a 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 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')) | |
bot.send_game(chat_id, "Calc1") | |
@bot.callback_query_handler(func=lambda call: True) | |
def button_callback(call): | |
bot.answer_callback_query(call.id, text='Enjoy The Game!',url='http://simorgh.foxinia.ir',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