Advertisement
kubo_yam

Untitled

Dec 9th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.04 KB | None | 0 0
  1. import config
  2. import telebot
  3. from telebot import types
  4.  
  5. bot = telebot.TeleBot(config.token)
  6.  
  7. print('Bot has been started')
  8.  
  9. markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  10. markup.row('📦 Скачать Termux', '📚 Установка софта', '📱 Кастомизация')
  11. markup.row('🌐 Telegram чат Termux', 'ℹ️ Помощь', '💬 Оставить отзыв')
  12. remove_markup = types.ReplyKeyboardRemove()
  13.  
  14. @bot.message_handler(commands=['start'])
  15. def handle_start(message):
  16. print(message.from_user.username + ' зашел')
  17. bot.send_message(message.chat.id, 'Добрый день', reply_markup=remove_markup)
  18. bot.send_message(message.chat.id, "Выбери рубрику: ", reply_markup=markup)
  19. #Вот на этом моменте, после вызова этой фйнкции 2 раз, бот крашится
  20. @bot.message_handler(commands=['comment'])
  21. def comment(message):
  22. msg = bot.send_message(message.chat.id, 'Введите отзыв:')
  23. bot.register_next_step_handler(msg, rewiew)
  24.  
  25. def rewiew(message):
  26. print(message.from_user.username + ' оставил отзыв: ' + message.text)
  27. file = open('review.txt', 'a')
  28. file.write(message.from_user.username + ' говорит: ' + message.text + '\n')
  29.  
  30. @bot.message_handler(content_types=['text'])
  31. def choose_handle(message):
  32. if message.text == '📦 Скачать Termux':
  33. keyboard = types.InlineKeyboardMarkup()
  34. keyboard.add(types.InlineKeyboardButton(text="Скачать Termux(4PDA)", url="https://4pda.ru/forum/lofiversion/index.php?t741456.html"))
  35. keyboard.add(types.InlineKeyboardButton(text="Скачать Termux(Google Play)", url="https://play.google.com/store/apps/details?id=com.termux&hl=ru"))
  36. keyboard.add(types.InlineKeyboardButton(text="Скачать Add-ons для Termux(4PDA)", url="https://4pda.ru/forum/index.php?showtopic=741456&st=340#entry67974935"))
  37. bot.send_message(message.chat.id, "Нажми на кнопку и скачай нужную программу.", reply_markup=keyboard)
  38. if message.text == '📚 Установка софта':
  39. keyboard = types.InlineKeyboardMarkup()
  40. keyboard.add(types.InlineKeyboardButton(text="Что нужно сделать сразу после установки Termux", url="https://telegra.ph/CHto-nuzhno-sdelat-srazu-posle-ustanovki-Termux-12-07"))
  41. keyboard.add(types.InlineKeyboardButton(text="Установка nethunter в termux", url="https://telegra.ph/Ustanovka-nethunter-v-termux-12-07"))
  42. keyboard.add(types.InlineKeyboardButton(text="Установка DarkFly в termux (tools 500+)", url="https://telegra.ph/Ustanovka-DarkFly-v-termux-tools-500-12-07"))
  43. keyboard.add(types.InlineKeyboardButton(text="Установка instainsane в termux/nethunter (Брут Instagram)", url="https://telegra.ph/Ustanovka-instainsane-v-termuxnethunter-brut-Instagram-12-07"))
  44. keyboard.add(types.InlineKeyboardButton(text="Установка metasploit в termux", url="https://telegra.ph/Ustanovka-metasploit-v-termux-12-07"))
  45. keyboard.add(types.InlineKeyboardButton(text="Установка Tmux-Bunch в termux (аналог apktool)", url="https://telegra.ph/Ustanovka-Tmux-Bunch-v-termux-analog-apktool-12-07"))
  46. keyboard.add(types.InlineKeyboardButton(text="Установка Tmux(менеджер терминалов,работа в нескольких окнах одновременно)", url="https://telegra.ph/Ustanovka-Tmuxmenedzher-terminalovrabota-v-neskolkih-oknah-odnovremenno-12-07"))
  47. keyboard.add(types.InlineKeyboardButton(text="Полный фарш на termux для Python", url="https://telegra.ph/Polnyj-farsh-na-termux-dlya-Python-12-07"))
  48. keyboard.add(types.InlineKeyboardButton(text="Установка и использование Apache2 в Termux", url="https://telegra.ph/Ustanovka-i-ispolzovanie-Apache2-v-Termux-12-08"))
  49. bot.send_message(message.chat.id, "Нажми на кнопку и откроется статья.", reply_markup=keyboard)
  50. if message.text == '📱 Кастомизация':
  51. keyboard = types.InlineKeyboardMarkup()
  52. keyboard.add(types.InlineKeyboardButton(text="Кастомизация Termux", url="https://telegra.ph/Kastomizaciya-Termux-12-07"))
  53. bot.send_message(message.chat.id, "Нажми на кнопку и откроется статья.", reply_markup=keyboard)
  54. if message.text == '🌐 Telegram чат Termux':
  55. keyboard = types.InlineKeyboardMarkup()
  56. keyboard.add(types.InlineKeyboardButton(text="Termux | 4PDA | RU", url="tg://join?invite=HYcitEbYSwDAXIchuhpAZw"))
  57. bot.send_message(message.chat.id, "Ссылка на чат", reply_markup=keyboard)
  58. if message.text == 'ℹ️ Помощь':
  59. bot.send_message(message.chat.id, 'Привет, я бот, который поможет использовать Termux на все 100%!')
  60. bot.send_message(message.chat.id, 'Автор всех статей - @X_Selent')
  61. bot.send_message(message.chat.id, 'Автор бота - @d3fault_1, Значительная помощь в создании бота - @dazaiko')
  62. bot.send_message(message.chat.id, 'Чтобы начать пиши /start')
  63. if message.text == '💬 Оставить отзыв':
  64. bot.send_message(message.chat.id, '🔥 Напиши свой отзыв или идею по улучшению бота, и возможно автор воплотит твою задумку в жизнь!')
  65. bot.send_message(message.chat.id, 'Чтобы оставить отзыв напиши команду /comment')
  66.  
  67.  
  68. @bot.message_handler(commands=['help'])
  69. def handle_help(message):
  70. bot.send_message(message.chat.id, 'Привет, я бот, который обеспечит тебя минимальной анонимностью!')
  71. bot.send_message(message.chat.id, 'Чтобы начать пиши /start')
  72.  
  73. if __name__ == '__main__':
  74. bot.polling(none_stop=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement