Skip to content

Instantly share code, notes, and snippets.

View baden's full-sized avatar
🏠
Working from home

Денис baden

🏠
Working from home
  • бездельник и лоботряс
  • Каменское
View GitHub Profile

Інструкція по налаштуванню Телеграм-бота.

Відкрийте бота @fenix_testuser7_bot

Це можна зробити вставивши у строку пошука в Телеграм @fenix_testuser7_bot

Якшо бот автоматично не написав код для доступа, можна запросити код натиснувши "Меню" -> "/start - Додати систему." Або ввести повідомлення для бота: /start

Бот відповість повідомленням типу:

Чомусь не працює HTTPS (та і SSL через TCP/IP). Шо я упускаю?

Шо робив: Увага! Тут збережен токен для Telegram-бота. Я потім його видалю, а пока прохання не ддудосити ;)

  1. Завантажую кореневий сертифікат для api.telegram.org:
// Include simple random number generator to ensure results will be the
// same cross platform.
// http://en.wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator
uint32_t lcg_seed = 48271;
uint32_t lcg_rand() {
return lcg_seed = ((uint64_t)lcg_seed * 279470273UL) % 4294967291UL;
}
void lcg_reset() { lcg_seed = 48271; }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1> 00:00:00 +15.000 Hello, world!!!
2< 00:00:00 +15.000 Hello, world!!!
1> 00:00:00 +15.000 Hello, world!!!
2< 00:00:00 +15.000 OK
1> 00:00:00 +15.000 Hello, world!!!
2< 00:00:00 +15.000 Hello, world!!!
1> 00:00:00 +15.000 Hello, world!!!
2< 00:00:00 +15.000 OK
1> 00:00:00 +15.000 Hello, world!!!
2< 00:00:00 +15.000 Hello, world!!!

#!/usr/bin/env python
# Thread pool based on: http://code.activestate.com/recipes/577187-python-thread-pool/
from queue import Queue
from threading import Thread
from functools import partial
import tornado.httpserver
import tornado.ioloop
import tornado.options
"""Simple TCP server for playing Tic-Tac-Toe game.
Use Player-to-Player game mode based on naming auth.
No thoughts about distribution or pub/sub mode
(for monitoring or something like this). Just
basic functionality.
"""
import time
import logging