Skip to content

Instantly share code, notes, and snippets.

View muhammedfurkan's full-sized avatar
🙃

M.Furkan muhammedfurkan

🙃
View GitHub Profile
@muhammedfurkan
muhammedfurkan / split.py
Created April 25, 2020 20:22 — forked from behf/split.py
split a long text into small chunks, it won't cut your words.
def split_message(text, length=4096, offset=200):
return [text[text.find('\n', i - offset, i + 1) if text.find('\n', i - offset, i + 1) != -1 else i:
text.find('\n', i + length - offset, i + length) if text.find('\n', i + length - offset,
i + length) != -1 else i + length] for
i
in
range(0, len(text), length)]
# Usage, Using Pyrogram
@muhammedfurkan
muhammedfurkan / call.py
Created April 25, 2020 20:21 — forked from painor/call.py
Make a call using pyrogram
#This is taken from https://github.com/LonamiWebs/Telethon-calls/blob/master/calls.py and modified
import hashlib
import os
import random
from pyrogram import Client
from pyrogram.api.functions.messages import GetDhConfig
from pyrogram.api.functions.phone import RequestCall
from pyrogram.api.types import PhoneCallProtocol
@muhammedfurkan
muhammedfurkan / autoreplier.py
Created April 25, 2020 20:20 — forked from yi-jiayu/autoreplier.py
Automatic replies for Telegram (Updated for Telethon 1.6.2)
import time
from telethon import TelegramClient, events
# sample API_ID from https://github.com/telegramdesktop/tdesktop/blob/f98fdeab3fb2ba6f55daf8481595f879729d1b84/Telegram/SourceFiles/config.h#L220
# or use your own
api_id = 17349
api_hash = '344583e45741c457fe1862106095a5eb'
# fill in your own details here
import aioschedule as schedule
import asyncio
from telethon import TelegramClient
with TelegramClient(
os.path.abspath(fileName),
config.getint("api", "api_id"),
config.get("api", "api_hash"),
connection_retries=15,
retry_delay=3,