Skip to content

Instantly share code, notes, and snippets.

View Kylmakalle's full-sized avatar

Sergey Akentev Kylmakalle

View GitHub Profile
@Kylmakalle
Kylmakalle / bots.conf
Created September 9, 2017 18:13
nginx.conf appender for routing to local webservers
server {
listen 443 ssl;
server_name domain.com;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
# First Entry
location /VAR1/ {
proxy_pass http://127.0.0.1:VAR2/;
@Kylmakalle
Kylmakalle / main.py
Created August 6, 2017 19:10 — forked from gurland/main.py
How to delete all your messages from chat in telegram? Easy, just use this program
from telethon import TelegramClient
from telethon.errors import SessionPasswordNeededError
from telethon.tl.functions.messages import GetHistoryRequest
from telethon.tl.functions.channels import DeleteMessagesRequest
from telethon.tl.types.channel import Channel
import shelve
from os import listdir
from time import sleep
# Просто утилиты
{'animation': {'file_id': None,
'file_name': 'animation.gif.mp4',
'file_size': 192239,
'mime_type': 'video/mp4',
# from moviepy.editor import *
# import telebot
# import threading
# ...receive message with link to .webm...
def convert_webm_to_mp4(message, m):
video = VideoFileClip(m.group(0))
converting = bot.reply_to(message, '<i>Конвертирую...</i>', parse_mode='HTML')
bot.send_chat_action(message.chat.id, 'upload_video')
# -*- coding: utf-8 -*-
import requests
s = requests.session()
URL = 'https://2ch.hk/'
BOARD = 'test'
THREAD = '31942'
from telethon import TelegramClient
from telethon.tl.functions.messages import GetFullChatRequest
api_id = 12345 # my.telegram.org
api_hash = 'n91hds91hd90qwd' # credenitals
phone_number = '+1231241213'
client = TelegramClient('telegram_script', api_id, api_hash) # feel free to edit %sessionname% as you want
client.connect() # logining and connecting to Telegram servers
if blocked.contains(users.ID == str(message.new_chat_member.id)):
bot.kick_chat_member(message.chat.id, message.new_chat_member.id)
bot.send_message(message.chat.id, '`' + message.new_chat_member.first_name + '`' + ' was blocked',
parse_mode='Markdown')
bot.send_message(me, '`' + message.new_chat_member.first_name + '`' + ' #id' + str(
message.new_chat_member.id) + ' was banned because of *BLOCK* in #{}'.format(message.chat.username),
parse_mode='Markdown')
blocked.remove(eids=[blocked.get(users.ID == str(message.new_chat_member.id)).eid])
@Kylmakalle
Kylmakalle / video_note_test.py
Last active May 19, 2017 15:21
Testing send_video_note method in pyTelegramBotAPI
import telebot
token = '123456789:AAAbbbCccDDDEEEffFGGgHHhIIijjJ12345'
bot = telebot.TeleBot(token)
@bot.channel_post_handler(content_types=['video_note'])
def converting(message):
bot.get_file(message.video_note.file_id)
videonote = bot.download_file(bot.get_file(message.video_note.file_id).file_path)
from telethon import TelegramClient
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsRecent
from telethon.utils import get_input_peer
api_id = 123456 # Use your own values here. https://my.telegram.org
api_hash = '0123456789abcdef0123456789abcdef'
phone_number = '+34600000000'
client = TelegramClient('%sessionname%', api_id, api_hash) # feel free to edit %sessionname% as you want
import telebot
import wget
token = '123456789:AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLL'
chatid = 12345678
bot = telebot.TeleBot(token)
file = 'http://dictionary.cambridge.org/media/english/uk_pron_ogg/u/ukh/ukhef/ukheft_029.ogg'
file = wget.download(file)
file = open(file, 'rb')