Skip to content

Instantly share code, notes, and snippets.

View Kylmakalle's full-sized avatar

Sergey Akentev Kylmakalle

View GitHub Profile
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher, filters
from aiogram.utils import executor
import re
class RegexpCommandsFilter(filters.AsyncFilter):
"""
Check commands by regexp in message
"""
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdio.h>
void DeleteLine(int delay=10000){
usleep(delay);
std::cout << "\033[A\033[2K";
}
@Kylmakalle
Kylmakalle / bot.py
Last active October 25, 2017 16:53
Proxying telegram updates to local webserver using nginx
import telebot
import flask
from credentials import token, host, port, DEBUG
API_TOKEN = token
WEBHOOK_HOST = host
WEBHOOK_PORT = port
WEBHOOK_URL_BASE = "https://%s" % (WEBHOOK_HOST)
# -*- coding: utf-8 -*-
import json
import logging
import requests
import flask
# https://play.google.com/store/apps/details?id=app.greyshirts.sslcapture for Token and User-Agent
vkapi_url = 'https://api.vk.com/method/audio.getById'
vk_token = 'qwertyuiopasdfghjklzxcvbnm1234567890'
@Kylmakalle
Kylmakalle / buttons_antispam.py
Created October 1, 2017 21:53
Telegram is bugged as hell, really
import telebot
from telebot.types import InlineKeyboardButton, InlineKeyboardMarkup
bot = telebot.TeleBot('123456789:wedcvbhjmlkjhbnjkhfdjkhfd')
ANTISPAMBOT = bot.get_me()
KNOWN_USERS = []
@bot.message_handler(content_types=['new_chat_members'])
@Kylmakalle
Kylmakalle / two_step_login.py
Last active September 21, 2017 14:02
Two step login-in in Telegram using https://github.com/LonamiWebs/Telethon
from telethon import TelegramClient
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
phone = '+34600000000'
# First Connect
client = TelegramClient('user_{}'.format(phone[1:]), api_id, api_hash)
client.connect()
#include <string>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <memory.h>
// For blocked reading pressed symbol
def shut_dow(s):
if s == "yes":
return "Shutting down"
elif s == "no":
return "Shutdown aborted"
return "Sorry"
void binary_form(int TYPE) {
int z;
for (char j = sizeof(int) * 8 - 1; j >= 0; j--) {
z = ((int)1) << j;
if ((TYPE & z) != 0)
std::cout << 1;
else
std::cout << 0;
}
}
@Kylmakalle
Kylmakalle / credentials.py
Last active September 14, 2017 14:48
Backup Group Butler's chat settings
api_id = 111337 # my.telegram.org
api_hash = 'blblbla12317823123789127809'
phone_number = '+79991488228'