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 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, |
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 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 |
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
#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 |
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
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 |
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
# copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py | |
# Copyright (C) 2021 Tulir Asokan | |
import asyncio | |
import hashlib | |
import inspect | |
import logging | |
import math | |
import os | |
from collections import defaultdict | |
from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import sys | |
if (sys.version_info < (3, 0)): | |
# Python 3 code in this block | |
print('Python v3.5 or above required for Instaloader module at the moment. Exiting...') | |
quit() |
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
String.prototype.turkishtoEnglish = function () { | |
return this.replace('Ğ','g') | |
.replace('Ü','u') | |
.replace('Ş','s') | |
.replace('I','i') | |
.replace('İ','i') | |
.replace('Ö','o') | |
.replace('Ç','c') | |
.replace('ğ','g') | |
.replace('ü','u') |
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
server { | |
root /var/www/html; | |
index index.html index.htm index.nginx-debian.html; | |
server_name example.com; | |
include /etc/nginx/mime.types; | |
} | |
server { | |
if ($host = example.com) { |
OlderNewer