This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
tokens = { | |
'123454321:abcdefghABCDEFGHIoqwe-123ejksdaaasd', | |
'987654321:xyzzyxABCabcTELEBOTadasd12389012nss', | |
'123456789:AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLL', | |
} | |
for token in tokens: | |
r = requests.get('https://api.telegram.org/bot{}/getMe'.format(token)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
s = requests.session() | |
URL = 'https://2ch.hk/' | |
BOARD = 'test' | |
THREAD = '31942' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'animation': {'file_id': None, | |
'file_name': 'animation.gif.mp4', | |
'file_size': 192239, | |
'mime_type': 'video/mp4', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# Просто утилиты |
OlderNewer