Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. import os
  2.  
  3. import telebot
  4. from telebot import types
  5. from flask import Flask, request
  6.  
  7. bot = telebot.TeleBot("TOKEN")
  8. server = Flask(__name__)
  9. TOKEN = 'TOKEN'
  10. @server.route('/' + TOKEN, methods=['POST'])
  11. def getMessage():
  12. bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
  13. return "!", 200
  14.  
  15.  
  16. @server.route("/")
  17. def webhook():
  18. bot.remove_webhook()
  19. bot.set_webhook(url='https://quiet-lake-27894.herokuapp.com/' + TOKEN)
  20. return "!", 200
  21.  
  22.  
  23. if __name__ == "__main__":
  24. server.run(host="0.0.0.0", port=int(os.environ.get('PORT', 5000)))
  25.  
  26. @bot.message_handler(commands=['start'])
  27. def start(m):
  28. gif = 'CgACAgQAAxkBAAIBM15OxkUofuioKz0XxMs10xdgceZGAAI7BgACnfd4Ul_T32ps-cQOGAQ'
  29. kb = types.InlineKeyboardMarkup()
  30. kb.add(types.InlineKeyboardButton(text="קהילה 👨🏽‍💻", url='https://t.me/GanKasom'))
  31. kb.add(types.InlineKeyboardButton(text='מגדלים 🧑🏽‍🌾', url='https://t.me/GanKasomGrow'))
  32. kb.add(types.InlineKeyboardButton(text='יד שנייה 📦', url='https://t.me/GanKasomExchange'))
  33. kb.add(types.InlineKeyboardButton(text='כיוונים 📍', url='https://t.me/GanKasomCivonim'))
  34. kb.add(types.InlineKeyboardButton(text='ביקורות 💭', url='https://t.me/GanKasomReviews'))
  35. kb.add(types.InlineKeyboardButton(text='בוט ביקורות 📝', url='https://t.me/GanKasomReviews'))
  36. bot.send_document(m.chat.id, gif, reply_markup = kb)
  37.  
  38.  
  39. def keyboard():
  40. markup = types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
  41. btn1 = types.KeyboardButton('בוט הגזע')
  42. markup.add(btn1)
  43. return markup
  44.  
  45. if __name__ == '__main__':
  46.  
  47. bot.polling(none_stop=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement