Added and updated repositories 2025-07-11 08:27:20

This commit is contained in:
github-actions[bot]
2025-07-11 08:27:20 +00:00
parent 35e8befc45
commit e328cd957a
320 changed files with 37419 additions and 33510 deletions

View File

@@ -1,68 +1,68 @@
from pydub import AudioSegment
from .. import loader, utils
import io
import os
def register(cb):
cb(AudioShakalMod())
class AudioShakalMod(loader.Module):
"""АудиоШакал"""
strings = {'name': 'АудиоШакал'}
def __init__(self):
self.name = self.strings['name']
self._me = None
self._ratelimit = []
async def client_ready(self, client, db):
self._db = db
self._client = client
self.me = await client.get_me()
async def fvcmd(self, message):
"""<b>.fv <reply to voice/mp3/ogg/oga> [шакал_lvl(не обязательно, по умолчанию 100 (от 10 до 100))]
Сшакалить войс/mp3/ogg/oga</b>
"""
reply = await message.get_reply_message()
lvl = 0
if not reply:
await message.edit("<b>Ответь на аудио стоны, еблан</b>")
return
if utils.get_args_raw(message):
ar = utils.get_args_raw(message)
try:
int(ar)
if int(ar) >= 10 and int(ar) <= 100:
lvl = int(ar)
else:
await message.edit("<b>Укажите уровень долбоебизма от 10 до 100!</b>")
return
except Exception as exx:
await message.edit("<b>Неверный аргумент(ты уебок кста)!</b>")
return
else:
lvl = 100
await message.edit("<b>Ебем Стасяна... (прости Стасян)</b>\n Прощаю (с) Стасян")
sa = False
m = io.BytesIO()
fname = await message.client.download_media(message=reply.media)
if(fname.endswith(".oga") or fname.endswith(".ogg")):
audio = AudioSegment.from_file(fname, "ogg")
elif(fname.endswith(".mp3")):
sa = True
audio = AudioSegment.from_file(fname, "mp3")
else:
await message.edit("<b>Ты еблан? Я(.fv) не поддерживаю этот ёбаный файл! Только voice/mp3/ogg/oga!</b>")
os.remove(fname)
return
audio = audio + lvl
if(sa):
m.name = "Ты Шакал.mp3"
audio.export(m, format="mp3")
else:
m.name="voice.ogg"
audio.split_to_mono()
audio.export(m, format="ogg", codec="libopus", bitrate="64k")
m.seek(0)
if(sa):
await message.client.send_file(message.to_id, m, reply_to=reply.id)
else:
await message.client.send_file(message.to_id, m, reply_to=reply.id, voice_note=True)
await message.delete()
os.remove(fname)
from pydub import AudioSegment
from .. import loader, utils
import io
import os
def register(cb):
cb(AudioShakalMod())
class AudioShakalMod(loader.Module):
"""АудиоШакал"""
strings = {'name': 'АудиоШакал'}
def __init__(self):
self.name = self.strings['name']
self._me = None
self._ratelimit = []
async def client_ready(self, client, db):
self._db = db
self._client = client
self.me = await client.get_me()
async def fvcmd(self, message):
"""<b>.fv <reply to voice/mp3/ogg/oga> [шакал_lvl(не обязательно, по умолчанию 100 (от 10 до 100))]
Сшакалить войс/mp3/ogg/oga</b>
"""
reply = await message.get_reply_message()
lvl = 0
if not reply:
await message.edit("<b>Ответь на аудио стоны, еблан</b>")
return
if utils.get_args_raw(message):
ar = utils.get_args_raw(message)
try:
int(ar)
if int(ar) >= 10 and int(ar) <= 100:
lvl = int(ar)
else:
await message.edit("<b>Укажите уровень долбоебизма от 10 до 100!</b>")
return
except Exception as exx:
await message.edit("<b>Неверный аргумент(ты уебок кста)!</b>")
return
else:
lvl = 100
await message.edit("<b>Ебем Стасяна... (прости Стасян)</b>\n Прощаю (с) Стасян")
sa = False
m = io.BytesIO()
fname = await message.client.download_media(message=reply.media)
if(fname.endswith(".oga") or fname.endswith(".ogg")):
audio = AudioSegment.from_file(fname, "ogg")
elif(fname.endswith(".mp3")):
sa = True
audio = AudioSegment.from_file(fname, "mp3")
else:
await message.edit("<b>Ты еблан? Я(.fv) не поддерживаю этот ёбаный файл! Только voice/mp3/ogg/oga!</b>")
os.remove(fname)
return
audio = audio + lvl
if(sa):
m.name = "Ты Шакал.mp3"
audio.export(m, format="mp3")
else:
m.name="voice.ogg"
audio.split_to_mono()
audio.export(m, format="ogg", codec="libopus", bitrate="64k")
m.seek(0)
if(sa):
await message.client.send_file(message.to_id, m, reply_to=reply.id)
else:
await message.client.send_file(message.to_id, m, reply_to=reply.id, voice_note=True)
await message.delete()
os.remove(fname)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,22 @@
from .. import loader, utils
import calendar
from datetime import date
def register(cb):
cb(CalendarMod())
class CalendarMod(loader.Module):
"""Календарь"""
strings = {"name": "Calendar"}
async def clndcmd(self, event):
""".clnd <год> <месяц> или ничего"""
args = utils.get_args(event)
y, m, d = [int(i) for i in str(date.today()).split("-")]
year = int(args[0]) if args and args[0].isdigit() else y
month = int(args[1]) if len(args) == 2 and args[1].isdigit() and int(args[1]) in range(1, 13) else m
calen = calendar.month(year, month)
if year == y and month == m:
calen = calen.replace(str(d), f'</code><strong>{d}</strong><code>')
from .. import loader, utils
import calendar
from datetime import date
def register(cb):
cb(CalendarMod())
class CalendarMod(loader.Module):
"""Календарь"""
strings = {"name": "Calendar"}
async def clndcmd(self, event):
""".clnd <год> <месяц> или ничего"""
args = utils.get_args(event)
y, m, d = [int(i) for i in str(date.today()).split("-")]
year = int(args[0]) if args and args[0].isdigit() else y
month = int(args[1]) if len(args) == 2 and args[1].isdigit() and int(args[1]) in range(1, 13) else m
calen = calendar.month(year, month)
if year == y and month == m:
calen = calen.replace(str(d), f'</code><strong>{d}</strong><code>')
await event.edit(f"<code>\u2060{calen}</code>")

View File

@@ -1,14 +1,14 @@
from .. import loader
def register(cb):
cb(DontWorkMod())
class DontWorkMod(loader.Module):
"""Модуль не работает."""
strings = {'name': 'Don`t Work'}
async def dontworkcmd(self, message):
"""Используй .dontwork, чтобы понять, что модуль не работает."""
dontwork = '<b>Модуль не работает.</b>'
from .. import loader
def register(cb):
cb(DontWorkMod())
class DontWorkMod(loader.Module):
"""Модуль не работает."""
strings = {'name': 'Don`t Work'}
async def dontworkcmd(self, message):
"""Используй .dontwork, чтобы понять, что модуль не работает."""
dontwork = '<b>Модуль не работает.</b>'
await message.edit(dontwork)

View File

@@ -1,38 +1,38 @@
from .. import loader, utils
from random import choice, randint
from asyncio import sleep
def register(cb):
cb(FakeActionsMod())
class FakeActionsMod(loader.Module):
"""Показывает фейковые действия."""
strings = {'name': 'Fake Actions'}
async def fakecmd(self, event):
"""Использование: .fake <действие>.\nСписок действий: typing, contact, game, location, record-audio, record-round, record-video, voice, round, video, photo, document.\nОтмена: .fake cancel"""
options = ['typing', 'contact', 'game', 'location', 'record-audio', 'record-round',
'record-video', 'voice', 'round', 'video', 'photo', 'document', 'cancel']
args = utils.get_args_raw(event).split()
if len(args) == 0:
fake_action = choice(options)
fake_time = randint(30, 60)
elif len(args) == 1:
try:
fake_action = str(args[0]).lower()
fake_time = randint(30, 60)
except ValueError:
fake_action = choice(options)
fake_time = int(args[0])
elif len(args) == 2:
fake_action = str(args[0]).lower()
fake_time = int(args[1])
else:
return await event.edit('Неправильный ввод.')
try:
await event.delete()
async with event.client.action(event.chat_id, fake_action):
await sleep(fake_time)
except BaseException:
from .. import loader, utils
from random import choice, randint
from asyncio import sleep
def register(cb):
cb(FakeActionsMod())
class FakeActionsMod(loader.Module):
"""Показывает фейковые действия."""
strings = {'name': 'Fake Actions'}
async def fakecmd(self, event):
"""Использование: .fake <действие>.\nСписок действий: typing, contact, game, location, record-audio, record-round, record-video, voice, round, video, photo, document.\nОтмена: .fake cancel"""
options = ['typing', 'contact', 'game', 'location', 'record-audio', 'record-round',
'record-video', 'voice', 'round', 'video', 'photo', 'document', 'cancel']
args = utils.get_args_raw(event).split()
if len(args) == 0:
fake_action = choice(options)
fake_time = randint(30, 60)
elif len(args) == 1:
try:
fake_action = str(args[0]).lower()
fake_time = randint(30, 60)
except ValueError:
fake_action = choice(options)
fake_time = int(args[0])
elif len(args) == 2:
fake_action = str(args[0]).lower()
fake_time = int(args[1])
else:
return await event.edit('Неправильный ввод.')
try:
await event.delete()
async with event.client.action(event.chat_id, fake_action):
await sleep(fake_time)
except BaseException:
return

View File

@@ -1,113 +1,113 @@
# requires: pillow, pymorphy2
import logging
from .. import loader, utils
import telethon
import requests
from PIL import Image, ImageFont, ImageDraw
import pymorphy2
import io
from io import BytesIO
import random
logger = logging.getLogger(__name__)
def register(cb):
cb(FamilyMod())
@loader.tds
class FamilyMod(loader.Module):
"""Quote a message"""
strings = {"name": "Family"}
async def client_ready(self, client, db):
self.client = message.client
@loader.unrestricted
@loader.ratelimit
async def familycmd(self, message):
args = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not reply:
await utils.answer(message, '<b>Нет Реплая.</b>')
return
if not args:
await utils.answer(message, '<b>Нет Текста.</b>')
return
pic = await check_media(message, reply)
if not pic:
await utils.answer(message, '<b>Нет Изображения.</b>')
return
await message.edit("Семья")
font = requests.get("https://github.com/KeyZenD/l/blob/master/bold.ttf?raw=true").content
family = makeFamily(pic, args, font)
await message.client.send_file(message.to_id, family, reply_to=reply)
await message.delete()
def place(background, image, cords, size):
overlay = Image.open(BytesIO(image))
overlay = overlay.resize((random.randint(size, size * 2), random.randint(size, size * 2)))
background.paste(overlay, cords)
def placeText(background , cords, size, text, font):
text_cords = (cords[0]+random.randint(0, size//2), cords[1]+random.randint(0, size//2))
draw = ImageDraw.Draw(background)
draw.text(text_cords, text, (0,0,0), font=ImageFont.truetype(io.BytesIO(font), random.randint(size // 8, size // 4)))
def makeFamily(image, caption, font):
morph = pymorphy2.MorphAnalyzer()
infl = morph.parse(caption)[0].inflect({'plur', 'gent'})
if not infl:
caption_mlt = caption
else:
caption_mlt = infl.word
canvas = Image.new('RGBA', (600, 600), "white")
draw = ImageDraw.Draw(canvas)
draw.text((120, 5), 'ахах семья ' + caption_mlt, (0,0,0), font=ImageFont.truetype(io.BytesIO(font), 32))
family = [
{ 'name': 'мама', 'cords': (60, 100), 'size': 160 },
{ 'name': 'папа', 'cords': (260, 80), 'size': 180 },
{ 'name': 'сын', 'cords': (60, 380), 'size': 125 },
{ 'name': 'дочь', 'cords': (230, 320), 'size': 125 },
{ 'name': 'дочь', 'cords': (225, 380), 'size': 125 },
{ 'name': 'сын', 'cords': (340, 390), 'size': 125 },
]
for member in family:
place(canvas, image, member['cords'], member['size'])
for member in family:
placeText(canvas, member['cords'], member['size'], member['name'] + ' ' + caption, font)
temp = BytesIO()
canvas.save(temp, format="png")
return temp.getvalue()
async def check_media(message, reply):
if reply and reply.media:
if reply.photo:
data = reply.photo
elif reply.document:
if reply.gif or reply.video or reply.audio or reply.voice:
return None
data = reply.media.document
else:
return None
else:
return None
if not data or data is None:
return None
else:
data = await message.client.download_file(data, bytes)
try:
Image.open(io.BytesIO(data))
return data
except:
return None
# requires: pillow, pymorphy2
import logging
from .. import loader, utils
import telethon
import requests
from PIL import Image, ImageFont, ImageDraw
import pymorphy2
import io
from io import BytesIO
import random
logger = logging.getLogger(__name__)
def register(cb):
cb(FamilyMod())
@loader.tds
class FamilyMod(loader.Module):
"""Quote a message"""
strings = {"name": "Family"}
async def client_ready(self, client, db):
self.client = message.client
@loader.unrestricted
@loader.ratelimit
async def familycmd(self, message):
args = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not reply:
await utils.answer(message, '<b>Нет Реплая.</b>')
return
if not args:
await utils.answer(message, '<b>Нет Текста.</b>')
return
pic = await check_media(message, reply)
if not pic:
await utils.answer(message, '<b>Нет Изображения.</b>')
return
await message.edit("Семья")
font = requests.get("https://github.com/KeyZenD/l/blob/master/bold.ttf?raw=true").content
family = makeFamily(pic, args, font)
await message.client.send_file(message.to_id, family, reply_to=reply)
await message.delete()
def place(background, image, cords, size):
overlay = Image.open(BytesIO(image))
overlay = overlay.resize((random.randint(size, size * 2), random.randint(size, size * 2)))
background.paste(overlay, cords)
def placeText(background , cords, size, text, font):
text_cords = (cords[0]+random.randint(0, size//2), cords[1]+random.randint(0, size//2))
draw = ImageDraw.Draw(background)
draw.text(text_cords, text, (0,0,0), font=ImageFont.truetype(io.BytesIO(font), random.randint(size // 8, size // 4)))
def makeFamily(image, caption, font):
morph = pymorphy2.MorphAnalyzer()
infl = morph.parse(caption)[0].inflect({'plur', 'gent'})
if not infl:
caption_mlt = caption
else:
caption_mlt = infl.word
canvas = Image.new('RGBA', (600, 600), "white")
draw = ImageDraw.Draw(canvas)
draw.text((120, 5), 'ахах семья ' + caption_mlt, (0,0,0), font=ImageFont.truetype(io.BytesIO(font), 32))
family = [
{ 'name': 'мама', 'cords': (60, 100), 'size': 160 },
{ 'name': 'папа', 'cords': (260, 80), 'size': 180 },
{ 'name': 'сын', 'cords': (60, 380), 'size': 125 },
{ 'name': 'дочь', 'cords': (230, 320), 'size': 125 },
{ 'name': 'дочь', 'cords': (225, 380), 'size': 125 },
{ 'name': 'сын', 'cords': (340, 390), 'size': 125 },
]
for member in family:
place(canvas, image, member['cords'], member['size'])
for member in family:
placeText(canvas, member['cords'], member['size'], member['name'] + ' ' + caption, font)
temp = BytesIO()
canvas.save(temp, format="png")
return temp.getvalue()
async def check_media(message, reply):
if reply and reply.media:
if reply.photo:
data = reply.photo
elif reply.document:
if reply.gif or reply.video or reply.audio or reply.voice:
return None
data = reply.media.document
else:
return None
else:
return None
if not data or data is None:
return None
else:
data = await message.client.download_file(data, bytes)
try:
Image.open(io.BytesIO(data))
return data
except:
return None

View File

@@ -1,33 +1,33 @@
from .. import loader, utils
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
def register(cb):
cb(OmonBotMod())
class OmonBotMod(loader.Module):
"""Омон бот."""
strings = {'name': 'FreeOmonBot'}
async def omoncmd(self, message):
"""Используй .omon <реплай на пикчу>."""
chat = "@FreeOmonBot"
reply = await message.get_reply_message()
if not reply:
await message.edit("<b>Нет реплая.</b>")
return
await message.edit("<b>Минуточку...</b>")
async with message.client.conversation(chat) as conv:
try:
response = conv.wait_event(events.NewMessage(incoming=True, from_users=775654752))
await message.client.send_message(chat, reply)
response = await response
except YouBlockedUserError:
await message.edit("<b>Разблокируй @FreeOmonBot</b>")
return
if response.text:
pass
if response.media:
await message.client.send_file(message.to_id, response.media)
from .. import loader, utils
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
def register(cb):
cb(OmonBotMod())
class OmonBotMod(loader.Module):
"""Омон бот."""
strings = {'name': 'FreeOmonBot'}
async def omoncmd(self, message):
"""Используй .omon <реплай на пикчу>."""
chat = "@FreeOmonBot"
reply = await message.get_reply_message()
if not reply:
await message.edit("<b>Нет реплая.</b>")
return
await message.edit("<b>Минуточку...</b>")
async with message.client.conversation(chat) as conv:
try:
response = conv.wait_event(events.NewMessage(incoming=True, from_users=775654752))
await message.client.send_message(chat, reply)
response = await response
except YouBlockedUserError:
await message.edit("<b>Разблокируй @FreeOmonBot</b>")
return
if response.text:
pass
if response.media:
await message.client.send_file(message.to_id, response.media)
await message.delete()

View File

@@ -1,34 +1,34 @@
import io
import os
from .. import loader
from PIL import Image
from gsbl.stick_bug import StickBug
def register(cb):
cb(GSBLMod())
class GSBLMod(loader.Module):
"""Фановый, мемный модуль."""
strings = {'name': 'Get-Stick-Bugged-Lol'}
async def gsblcmd(self, event):
"""Используй .gsbl <реплай на картинку/стикер>."""
try:
reply = await event.get_reply_message()
if not reply:
return await event.edit("Нет реплая на картинку/стикер.")
await event.edit("Минуточку...")
im = io.BytesIO()
await event.edit("Скачиваю...")
await event.client.download_file(reply, im)
await event.edit("Обрабатываю...")
im = Image.open(im)
sb = StickBug(im)
sb.save_video("get_stick_bugged_lol.mp4")
await event.edit("Отправляю...")
await event.client.send_file(event.to_id, open("get_stick_bugged_lol.mp4", "rb"), reply_to=reply)
os.remove("get_stick_bugged_lol.mp4")
await event.delete()
except:
import io
import os
from .. import loader
from PIL import Image
from gsbl.stick_bug import StickBug
def register(cb):
cb(GSBLMod())
class GSBLMod(loader.Module):
"""Фановый, мемный модуль."""
strings = {'name': 'Get-Stick-Bugged-Lol'}
async def gsblcmd(self, event):
"""Используй .gsbl <реплай на картинку/стикер>."""
try:
reply = await event.get_reply_message()
if not reply:
return await event.edit("Нет реплая на картинку/стикер.")
await event.edit("Минуточку...")
im = io.BytesIO()
await event.edit("Скачиваю...")
await event.client.download_file(reply, im)
await event.edit("Обрабатываю...")
im = Image.open(im)
sb = StickBug(im)
sb.save_video("get_stick_bugged_lol.mp4")
await event.edit("Отправляю...")
await event.client.send_file(event.to_id, open("get_stick_bugged_lol.mp4", "rb"), reply_to=reply)
os.remove("get_stick_bugged_lol.mp4")
await event.delete()
except:
return await event.edit("Это не картинка/стикер.")

View File

@@ -1,17 +1,17 @@
from .. import loader
from asyncio import sleep
@loader.tds
class HeartsMod(loader.Module):
strings = {"name": "Heart's"}
@loader.owner
async def lheartscmd(self, message):
for _ in range(10):
for lheart in ['', '️🧡', '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍']:
await message.edit(lheart)
await sleep(3)
async def sheartscmd(self, message):
for _ in range(10):
for sheart in ['', '️🧡', '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍']:
await message.edit(sheart)
from .. import loader
from asyncio import sleep
@loader.tds
class HeartsMod(loader.Module):
strings = {"name": "Heart's"}
@loader.owner
async def lheartscmd(self, message):
for _ in range(10):
for lheart in ['', '️🧡', '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍']:
await message.edit(lheart)
await sleep(3)
async def sheartscmd(self, message):
for _ in range(10):
for sheart in ['', '️🧡', '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍']:
await message.edit(sheart)
await sleep(0.3)

View File

@@ -1,137 +1,137 @@
import io
import requests
from .. import loader, utils
from random import choice, randint
from PIL import Image, ImageDraw, ImageFont
def register(cb):
cb(ImpMod())
class ImpMod(loader.Module):
"""Among Us"""
strings = {'name': 'Impostor?'}
async def impcmd(self, message):
"""Используй: .imp <@ или текст или реплай>."""
try:
background = requests.get(f"https://fl1yd.ml/modules/stuff/impostor{randint(1,22)}.png").content
font = requests.get("https://fl1yd.ml/modules/stuff/font2.ttf").content
await message.edit("Минуточку...")
reply = await message.get_reply_message()
args = utils.get_args_raw(message)
imps = ['wasn`t the impostor', 'was the impostor']
if not args and not reply:
user = await message.client.get_me()
text = (f"{user.first_name} {choice(imps)}.\n"
f"{randint(1, 2)} impostor(s) remain.")
if reply:
user = await utils.get_user(await message.get_reply_message())
text = (f"{user.first_name} {choice(imps)}.\n"
f"{randint(1, 2)} impostor(s) remain.")
if args:
user = await message.client.get_entity(args)
text = (f"{user.first_name} {choice(imps)}.\n"
f"{randint(1, 2)} impostor(s) remain.")
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
except:
text = args
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def ruimpcmd(self, message):
"""Используй: .ruimp <@ или текст или реплай>."""
try:
background = requests.get(f"https://fl1yd.ml/modules/stuff/impostor{randint(1,22)}.png").content
font = requests.get("https://fl1yd.ml/modules/stuff/font2.ttf").content
await message.edit("Минуточку...")
reply = await message.get_reply_message()
args = utils.get_args_raw(message)
imps = ['не был предателем', 'оказался одним из предалатей']
remain = randint(1, 2)
if remain == 1:
if not args and not reply:
user = await message.client.get_me()
text = (f"{user.first_name} {choice(imps)}.\n"
"1 предатель остался.")
if reply:
user = await utils.get_user(await message.get_reply_message())
text = (f"{user.first_name} {choice(imps)}.\n"
"1 предатель остался.")
if args:
user = await message.client.get_entity(args)
text = (f"{user.first_name} {choice(imps)}.\n"
"1 предатель остался.")
else:
if not args and not reply:
user = await message.client.get_me()
text = (f"{user.first_name} {choice(imps)}.\n"
"2 предателя осталось.")
if reply:
user = await utils.get_user(await message.get_reply_message())
text = (f"{user.first_name} {choice(imps)}.\n"
"2 предателя осталось.")
if args:
user = await message.client.get_entity(args)
text = (f"{user.first_name} {choice(imps)}.\n"
"2 предателя осталось.")
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
except:
text = args
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
import io
import requests
from .. import loader, utils
from random import choice, randint
from PIL import Image, ImageDraw, ImageFont
def register(cb):
cb(ImpMod())
class ImpMod(loader.Module):
"""Among Us"""
strings = {'name': 'Impostor?'}
async def impcmd(self, message):
"""Используй: .imp <@ или текст или реплай>."""
try:
background = requests.get(f"https://fl1yd.ml/modules/stuff/impostor{randint(1,22)}.png").content
font = requests.get("https://fl1yd.ml/modules/stuff/font2.ttf").content
await message.edit("Минуточку...")
reply = await message.get_reply_message()
args = utils.get_args_raw(message)
imps = ['wasn`t the impostor', 'was the impostor']
if not args and not reply:
user = await message.client.get_me()
text = (f"{user.first_name} {choice(imps)}.\n"
f"{randint(1, 2)} impostor(s) remain.")
if reply:
user = await utils.get_user(await message.get_reply_message())
text = (f"{user.first_name} {choice(imps)}.\n"
f"{randint(1, 2)} impostor(s) remain.")
if args:
user = await message.client.get_entity(args)
text = (f"{user.first_name} {choice(imps)}.\n"
f"{randint(1, 2)} impostor(s) remain.")
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
except:
text = args
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def ruimpcmd(self, message):
"""Используй: .ruimp <@ или текст или реплай>."""
try:
background = requests.get(f"https://fl1yd.ml/modules/stuff/impostor{randint(1,22)}.png").content
font = requests.get("https://fl1yd.ml/modules/stuff/font2.ttf").content
await message.edit("Минуточку...")
reply = await message.get_reply_message()
args = utils.get_args_raw(message)
imps = ['не был предателем', 'оказался одним из предалатей']
remain = randint(1, 2)
if remain == 1:
if not args and not reply:
user = await message.client.get_me()
text = (f"{user.first_name} {choice(imps)}.\n"
"1 предатель остался.")
if reply:
user = await utils.get_user(await message.get_reply_message())
text = (f"{user.first_name} {choice(imps)}.\n"
"1 предатель остался.")
if args:
user = await message.client.get_entity(args)
text = (f"{user.first_name} {choice(imps)}.\n"
"1 предатель остался.")
else:
if not args and not reply:
user = await message.client.get_me()
text = (f"{user.first_name} {choice(imps)}.\n"
"2 предателя осталось.")
if reply:
user = await utils.get_user(await message.get_reply_message())
text = (f"{user.first_name} {choice(imps)}.\n"
"2 предателя осталось.")
if args:
user = await message.client.get_entity(args)
text = (f"{user.first_name} {choice(imps)}.\n"
"2 предателя осталось.")
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
except:
text = args
font = io.BytesIO(font)
font = ImageFont.truetype(font, 30)
image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
w, h = draw.multiline_textsize(text=text, font=font)
image = Image.open(io.BytesIO(background))
x, y = image.size
draw = ImageDraw.Draw(image)
draw.multiline_text(((x - w) // 2, (y - h) // 2), text=text, font=font, fill="white", align="center")
output = io.BytesIO()
output.name = "impostor.png"
image.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()

View File

@@ -1,35 +1,35 @@
from .. import loader
from asyncio import sleep
import random
def register(cb):
cb(KickRandomMod())
class KickRandomMod(loader.Module):
"""Кик рандом."""
strings = {'name': 'KickRandom'}
async def kickrandcmd(self, event):
"""Используй .kickrand, чтобы кикнуть случайного пользователя (может кикнуть вас)."""
if event.chat:
chat = await event.get_chat()
admin = chat.admin_rights
creator = chat.creator
if not admin and not creator:
await event.edit('<b>Я здесь не админ.</b>')
return
user = random.choice([i for i in await event.client.get_participants(event.to_id)])
await event.edit('<b>Кому-то сейчас не повезёт...</b>')
await sleep(3)
try:
await event.client.kick_participant(event.chat_id, user.id)
await sleep(0.5)
except:
await event.edit('<b>У меня нет достаточных прав :с</b>')
return
await event.edit(f"<b>Рандом выбрал <a href=\"tg://user?id={user.id}\">{user.first_name}</a>, и он кикнут!</b>")
else:
from .. import loader
from asyncio import sleep
import random
def register(cb):
cb(KickRandomMod())
class KickRandomMod(loader.Module):
"""Кик рандом."""
strings = {'name': 'KickRandom'}
async def kickrandcmd(self, event):
"""Используй .kickrand, чтобы кикнуть случайного пользователя (может кикнуть вас)."""
if event.chat:
chat = await event.get_chat()
admin = chat.admin_rights
creator = chat.creator
if not admin and not creator:
await event.edit('<b>Я здесь не админ.</b>')
return
user = random.choice([i for i in await event.client.get_participants(event.to_id)])
await event.edit('<b>Кому-то сейчас не повезёт...</b>')
await sleep(3)
try:
await event.client.kick_participant(event.chat_id, user.id)
await sleep(0.5)
except:
await event.edit('<b>У меня нет достаточных прав :с</b>')
return
await event.edit(f"<b>Рандом выбрал <a href=\"tg://user?id={user.id}\">{user.first_name}</a>, и он кикнут!</b>")
else:
await event.edit('<b>Это не чат!</b>')

View File

@@ -1,46 +1,46 @@
import os
from .. import loader, utils
def register(cb):
cb(MediaCutterMod())
class MediaCutterMod(loader.Module):
"""Обрезать медиа."""
strings = {'name': 'MediaCutter'}
async def cutcmd(self, event):
"""Используй .cut <начало(сек):конец(сек)> <реплай на аудио/видео/гиф>."""
args = utils.get_args_raw(event).split(':')
reply = await event.get_reply_message()
if not reply or not reply.media:
return await event.edit('Нет реплая на медиа.')
if reply.media:
if args:
if len(args) == 2:
try:
await event.edit('Скачиваем...')
smth = reply.file.ext
await event.client.download_media(reply.media, f'uncutted{smth}')
if not args[0]:
await event.edit(f'Обрезаем с 0 сек. по {args[1]} сек....')
os.system(f'ffmpeg -i uncutted{smth} -ss 0 -to {args[1]} -c copy cutted{smth} -y')
elif not args[1]:
end = reply.media.document.attributes[0].duration
await event.edit(f'Обрезаем с {args[0]} сек. по {end} сек....')
os.system(f'ffmpeg -i uncutted{smth} -ss {args[0]} -to {end} -c copy cutted{smth} -y')
else:
await event.edit(f'Обрезаем с {args[0]} сек. по {args[1]} сек....')
os.system(f'ffmpeg -i uncutted{smth} -ss {args[0]} -to {args[1]} -c copy cutted{smth} -y')
await event.edit('Отправляем...')
await event.client.send_file(event.to_id, f'cutted{smth}', reply_to=reply.id)
os.system('rm -rf uncutted* cutted*')
await event.delete()
except:
await event.edit('Этот файл не поддерживается.')
os.system('rm -rf uncutted* cutted*')
return
else:
return await event.edit('Неверно указаны аргументы.')
else:
import os
from .. import loader, utils
def register(cb):
cb(MediaCutterMod())
class MediaCutterMod(loader.Module):
"""Обрезать медиа."""
strings = {'name': 'MediaCutter'}
async def cutcmd(self, event):
"""Используй .cut <начало(сек):конец(сек)> <реплай на аудио/видео/гиф>."""
args = utils.get_args_raw(event).split(':')
reply = await event.get_reply_message()
if not reply or not reply.media:
return await event.edit('Нет реплая на медиа.')
if reply.media:
if args:
if len(args) == 2:
try:
await event.edit('Скачиваем...')
smth = reply.file.ext
await event.client.download_media(reply.media, f'uncutted{smth}')
if not args[0]:
await event.edit(f'Обрезаем с 0 сек. по {args[1]} сек....')
os.system(f'ffmpeg -i uncutted{smth} -ss 0 -to {args[1]} -c copy cutted{smth} -y')
elif not args[1]:
end = reply.media.document.attributes[0].duration
await event.edit(f'Обрезаем с {args[0]} сек. по {end} сек....')
os.system(f'ffmpeg -i uncutted{smth} -ss {args[0]} -to {end} -c copy cutted{smth} -y')
else:
await event.edit(f'Обрезаем с {args[0]} сек. по {args[1]} сек....')
os.system(f'ffmpeg -i uncutted{smth} -ss {args[0]} -to {args[1]} -c copy cutted{smth} -y')
await event.edit('Отправляем...')
await event.client.send_file(event.to_id, f'cutted{smth}', reply_to=reply.id)
os.system('rm -rf uncutted* cutted*')
await event.delete()
except:
await event.edit('Этот файл не поддерживается.')
os.system('rm -rf uncutted* cutted*')
return
else:
return await event.edit('Неверно указаны аргументы.')
else:
return await event.edit('Нет аргументов')

View File

@@ -1,65 +1,65 @@
import os
from .. import loader, utils
from telethon import functions
def register(cb):
cb(OnAvaMod())
class OnAvaMod(loader.Module):
"""Гифку/видео/стикер на аву."""
strings = {'name': 'OnAva'}
async def onavacmd(self, message):
"""Установить на аву гифку/видео/стикер.\nИспользование: .onava <реплай>."""
try:
reply = await message.get_reply_message()
if reply:
await message.edit("Скачиваем...")
if reply.video:
await message.client.download_media(reply.media, "ava.mp4")
await message.edit("Конвертируем...")
os.system("ffmpeg -i ava.mp4 -c copy -an gifavaa.mp4 -y")
os.system("ffmpeg -i gifavaa.mp4 -vf scale=360:360 gifava.mp4 -y")
else:
await message.client.download_media(reply.media, "tgs.tgs")
await message.edit("Конвертируем...")
os.system("lottie_convert.py tgs.tgs tgs.gif; mv tgs.gif gifava.mp4")
else:
return await message.edit("Нет реплая на гиф/анимированный стикер/видеосообщение.")
await message.edit("Устанавливаем аву...")
await message.client(functions.photos.UploadProfilePhotoRequest(video=await message.client.upload_file("gifava.mp4"), video_start_ts=0.0))
await message.edit("Ава установлена.")
os.system("rm -rf ava.mp4 gifava.mp4 gifavaa.mp4 tgs.tgs tgs.gif")
except:
await message.edit("Произошла непредвиденная ошибка.")
os.system("rm -rf ava.mp4 gifava.mp4 gifavaa.mp4 tgs.tgs tgs.gif")
return
async def togifcmd(self, message):
"""Сделать из медиа гифку.\nИспользование: .togif <реплай>."""
try:
await message.edit("Скачиваем...")
reply = await message.get_reply_message()
if reply:
if reply.video:
await message.client.download_media(reply.media, "inputfile.mp4")
await message.edit("Конвертируем...")
os.system("ffmpeg -i inputfile.mp4 -vcodec copy -an outputfile.mp4")
await message.edit("Отправляем...")
await message.client.send_file(message.to_id, "outputfile.mp4")
elif reply.file.ext == ".tgs":
await message.client.download_media(reply.media, f"tgs.tgs")
await message.edit("Конвертируем...")
os.system("lottie_convert.py tgs.tgs tgs.gif")
await message.edit("Отправляем...")
await message.client.send_file(message.to_id, "tgs.gif", reply_to=reply.id)
else: return await message.edit("Этот файл не поддерживается.")
await message.delete()
os.system("rm -rf inputfile.mp4 outputfile.mp4 tgs.tgs tgs.gif")
else: return await message.edit("Нет реплая на видео/гиф/стикр.")
except:
await message.edit("Произошла непредвиденная ошибка.")
os.system("rm -rf inputfile.mp4 outputfile.mp4 tgs.tgs tgs.gif")
import os
from .. import loader, utils
from telethon import functions
def register(cb):
cb(OnAvaMod())
class OnAvaMod(loader.Module):
"""Гифку/видео/стикер на аву."""
strings = {'name': 'OnAva'}
async def onavacmd(self, message):
"""Установить на аву гифку/видео/стикер.\nИспользование: .onava <реплай>."""
try:
reply = await message.get_reply_message()
if reply:
await message.edit("Скачиваем...")
if reply.video:
await message.client.download_media(reply.media, "ava.mp4")
await message.edit("Конвертируем...")
os.system("ffmpeg -i ava.mp4 -c copy -an gifavaa.mp4 -y")
os.system("ffmpeg -i gifavaa.mp4 -vf scale=360:360 gifava.mp4 -y")
else:
await message.client.download_media(reply.media, "tgs.tgs")
await message.edit("Конвертируем...")
os.system("lottie_convert.py tgs.tgs tgs.gif; mv tgs.gif gifava.mp4")
else:
return await message.edit("Нет реплая на гиф/анимированный стикер/видеосообщение.")
await message.edit("Устанавливаем аву...")
await message.client(functions.photos.UploadProfilePhotoRequest(video=await message.client.upload_file("gifava.mp4"), video_start_ts=0.0))
await message.edit("Ава установлена.")
os.system("rm -rf ava.mp4 gifava.mp4 gifavaa.mp4 tgs.tgs tgs.gif")
except:
await message.edit("Произошла непредвиденная ошибка.")
os.system("rm -rf ava.mp4 gifava.mp4 gifavaa.mp4 tgs.tgs tgs.gif")
return
async def togifcmd(self, message):
"""Сделать из медиа гифку.\nИспользование: .togif <реплай>."""
try:
await message.edit("Скачиваем...")
reply = await message.get_reply_message()
if reply:
if reply.video:
await message.client.download_media(reply.media, "inputfile.mp4")
await message.edit("Конвертируем...")
os.system("ffmpeg -i inputfile.mp4 -vcodec copy -an outputfile.mp4")
await message.edit("Отправляем...")
await message.client.send_file(message.to_id, "outputfile.mp4")
elif reply.file.ext == ".tgs":
await message.client.download_media(reply.media, f"tgs.tgs")
await message.edit("Конвертируем...")
os.system("lottie_convert.py tgs.tgs tgs.gif")
await message.edit("Отправляем...")
await message.client.send_file(message.to_id, "tgs.gif", reply_to=reply.id)
else: return await message.edit("Этот файл не поддерживается.")
await message.delete()
os.system("rm -rf inputfile.mp4 outputfile.mp4 tgs.tgs tgs.gif")
else: return await message.edit("Нет реплая на видео/гиф/стикр.")
except:
await message.edit("Произошла непредвиденная ошибка.")
os.system("rm -rf inputfile.mp4 outputfile.mp4 tgs.tgs tgs.gif")
return

View File

@@ -1,194 +1,194 @@
import logging
from .. import loader, utils
import telethon
import requests, io, PIL
from telethon.tl.types import (MessageEntityBold, MessageEntityItalic,
MessageEntityMention, MessageEntityTextUrl,
MessageEntityCode, MessageEntityMentionName,
MessageEntityHashtag, MessageEntityCashtag,
MessageEntityBotCommand, MessageEntityUrl,
MessageEntityStrike, MessageEntityUnderline,
MessageEntityPhone, ChannelParticipantsAdmins,
ChannelParticipantCreator, ChannelParticipantAdmin,
User, Channel)
logger = logging.getLogger(__name__)
def register(cb):
cb(QuotesMod())
@loader.tds
class QuotesMod(loader.Module):
"""Quote a message"""
strings = {"name": "Quotes"}
async def client_ready(self, client, db):
self.client = message.client
@loader.unrestricted
@loader.ratelimit
async def quotecmd(self, message):
args = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not reply:
await utils.answer(message, '<b>Нет реплая</b>')
return
await message.edit("<b>Обработка...</b>")
if not args or not args.isdigit():
count = 1
else:
count = int(args.strip()) +1
msgs = []
cur = reply.id
cyr = cur + count
while cur != cyr:
msg = await message.client.get_messages(message.to_id, ids=cur)
if msg:
msgs.append(msg)
cur += 1
messages = []
avatars = {}
for reply in msgs:
text = reply.raw_text
entities = parse_entities(reply)
if reply.fwd_from:
id = reply.fwd_from.from_id or reply.fwd_from.channel_id
if not id:
id = 1234567890
name = reply.fwd_from.from_name
pfp = None
else:
sender = await message.client.get_entity(id)
name = (sender.first_name + ("" if not sender.last_name else " "+sender.last_name)) if type(sender) == User else sender.title
pfp = avatars.get(id, None)
if not pfp:
pfp = await message.client.download_profile_photo(sender.id, bytes)
if pfp:
pfp = 'https://telegra.ph'+requests.post('https://telegra.ph/upload', files={'file': ('file', pfp, None)}).json()[0]['src']
avatars[id] = pfp
else:
id = reply.from_id
sender = await message.client.get_entity(id)
name = (sender.first_name + ("" if not sender.last_name else " "+sender.last_name)) if type(sender) == User else sender.title
pfp = avatars.get(id, None)
if not pfp:
pfp = await message.client.download_profile_photo(reply.from_id, bytes)
if pfp:
pfp = 'https://telegra.ph'+requests.post('https://telegra.ph/upload', files={'file': ('file', pfp, None)}).json()[0]['src']
avatars[id] = pfp
image = await check_media(message, reply)
rreply = await reply.get_reply_message()
if rreply:
rtext = rreply.raw_text
rsender = rreply.sender
rname = (rsender.first_name + ("" if not rsender.last_name else " "+rsender.last_name)) if type(rsender) == User else rsender.title
rreply = {'author': rname, 'text': rtext}
admintitle = ""
if message.chat:
admins = await message.client.get_participants(message.to_id, filter=ChannelParticipantsAdmins)
if reply.sender in admins:
admin = admins[admins.index(reply.sender)].participant
admintitle = admin.rank if admin else ""
if not admintitle:
if type(admin) == ChannelParticipantCreator:
admintitle = "creator"
else:
admintitle = "admin"
messages.append({
"text": text,
"picture": image,
"reply": rreply,
"entities": entities,
"author": {
"id": id,
"name": name,
"adminTitle": admintitle,
"picture": pfp
}
})
data = {"messages": messages,
"maxWidth": 550,
"scaleFactor": 5,
"squareAvatar": False,
"textColor": "white",
"replyLineColor": "white",
"adminTitleColor": "#969ba0",
"messageBorderRadius": 10,
"pictureBorderRadius": 8,
"backgroundColor": "#162330"
}
await message.edit("<b>О б р а б о т к а . . .</b>")
r = requests.post("https://mishase.me/quote", json=data)
output = r.content
out = io.BytesIO()
out.name = "quote.webp"
PIL.Image.open(io.BytesIO(output)).save(out, "WEBP")
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()
def parse_entities(reply):
entities = []
if not reply.entities:
return []
for entity in reply.entities:
entity_type = type(entity)
start = entity.offset
end = entity.length
if entity_type is MessageEntityBold:
etype = 'bold'
elif entity_type is MessageEntityItalic:
etype = 'italic'
elif entity_type in [MessageEntityUrl, MessageEntityPhone]:
etype = 'url'
elif entity_type is MessageEntityCode:
etype = 'monospace'
elif entity_type is MessageEntityStrike:
etype = 'strikethrough'
elif entity_type is MessageEntityUnderline:
etype = 'underline'
elif entity_type in [MessageEntityMention, MessageEntityTextUrl,
MessageEntityMentionName, MessageEntityHashtag,
MessageEntityCashtag, MessageEntityBotCommand]:
etype = 'bluetext'
entities.append({'type': etype, 'offset': start, 'length': end})
return entities
async def check_media(message, reply):
if reply and reply.media:
if reply.photo:
data = reply.photo
elif reply.document:
if reply.gif or reply.video or reply.audio or reply.voice:
return None
data = reply.media.document
else:
return None
else:
return None
if not data or data is None:
return None
else:
data = await message.client.download_file(data, bytes)
img = io.BytesIO()
img.name = "img.png"
try:
PIL.Image.open(io.BytesIO(data)).save(img, "PNG")
link = 'https://telegra.ph'+requests.post('https://telegra.ph/upload', files={'file': ('file', img.getvalue(), "image/png")}).json()[0]['src']
return link
except:
return None
import logging
from .. import loader, utils
import telethon
import requests, io, PIL
from telethon.tl.types import (MessageEntityBold, MessageEntityItalic,
MessageEntityMention, MessageEntityTextUrl,
MessageEntityCode, MessageEntityMentionName,
MessageEntityHashtag, MessageEntityCashtag,
MessageEntityBotCommand, MessageEntityUrl,
MessageEntityStrike, MessageEntityUnderline,
MessageEntityPhone, ChannelParticipantsAdmins,
ChannelParticipantCreator, ChannelParticipantAdmin,
User, Channel)
logger = logging.getLogger(__name__)
def register(cb):
cb(QuotesMod())
@loader.tds
class QuotesMod(loader.Module):
"""Quote a message"""
strings = {"name": "Quotes"}
async def client_ready(self, client, db):
self.client = message.client
@loader.unrestricted
@loader.ratelimit
async def quotecmd(self, message):
args = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not reply:
await utils.answer(message, '<b>Нет реплая</b>')
return
await message.edit("<b>Обработка...</b>")
if not args or not args.isdigit():
count = 1
else:
count = int(args.strip()) +1
msgs = []
cur = reply.id
cyr = cur + count
while cur != cyr:
msg = await message.client.get_messages(message.to_id, ids=cur)
if msg:
msgs.append(msg)
cur += 1
messages = []
avatars = {}
for reply in msgs:
text = reply.raw_text
entities = parse_entities(reply)
if reply.fwd_from:
id = reply.fwd_from.from_id or reply.fwd_from.channel_id
if not id:
id = 1234567890
name = reply.fwd_from.from_name
pfp = None
else:
sender = await message.client.get_entity(id)
name = (sender.first_name + ("" if not sender.last_name else " "+sender.last_name)) if type(sender) == User else sender.title
pfp = avatars.get(id, None)
if not pfp:
pfp = await message.client.download_profile_photo(sender.id, bytes)
if pfp:
pfp = 'https://telegra.ph'+requests.post('https://telegra.ph/upload', files={'file': ('file', pfp, None)}).json()[0]['src']
avatars[id] = pfp
else:
id = reply.from_id
sender = await message.client.get_entity(id)
name = (sender.first_name + ("" if not sender.last_name else " "+sender.last_name)) if type(sender) == User else sender.title
pfp = avatars.get(id, None)
if not pfp:
pfp = await message.client.download_profile_photo(reply.from_id, bytes)
if pfp:
pfp = 'https://telegra.ph'+requests.post('https://telegra.ph/upload', files={'file': ('file', pfp, None)}).json()[0]['src']
avatars[id] = pfp
image = await check_media(message, reply)
rreply = await reply.get_reply_message()
if rreply:
rtext = rreply.raw_text
rsender = rreply.sender
rname = (rsender.first_name + ("" if not rsender.last_name else " "+rsender.last_name)) if type(rsender) == User else rsender.title
rreply = {'author': rname, 'text': rtext}
admintitle = ""
if message.chat:
admins = await message.client.get_participants(message.to_id, filter=ChannelParticipantsAdmins)
if reply.sender in admins:
admin = admins[admins.index(reply.sender)].participant
admintitle = admin.rank if admin else ""
if not admintitle:
if type(admin) == ChannelParticipantCreator:
admintitle = "creator"
else:
admintitle = "admin"
messages.append({
"text": text,
"picture": image,
"reply": rreply,
"entities": entities,
"author": {
"id": id,
"name": name,
"adminTitle": admintitle,
"picture": pfp
}
})
data = {"messages": messages,
"maxWidth": 550,
"scaleFactor": 5,
"squareAvatar": False,
"textColor": "white",
"replyLineColor": "white",
"adminTitleColor": "#969ba0",
"messageBorderRadius": 10,
"pictureBorderRadius": 8,
"backgroundColor": "#162330"
}
await message.edit("<b>О б р а б о т к а . . .</b>")
r = requests.post("https://mishase.me/quote", json=data)
output = r.content
out = io.BytesIO()
out.name = "quote.webp"
PIL.Image.open(io.BytesIO(output)).save(out, "WEBP")
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()
def parse_entities(reply):
entities = []
if not reply.entities:
return []
for entity in reply.entities:
entity_type = type(entity)
start = entity.offset
end = entity.length
if entity_type is MessageEntityBold:
etype = 'bold'
elif entity_type is MessageEntityItalic:
etype = 'italic'
elif entity_type in [MessageEntityUrl, MessageEntityPhone]:
etype = 'url'
elif entity_type is MessageEntityCode:
etype = 'monospace'
elif entity_type is MessageEntityStrike:
etype = 'strikethrough'
elif entity_type is MessageEntityUnderline:
etype = 'underline'
elif entity_type in [MessageEntityMention, MessageEntityTextUrl,
MessageEntityMentionName, MessageEntityHashtag,
MessageEntityCashtag, MessageEntityBotCommand]:
etype = 'bluetext'
entities.append({'type': etype, 'offset': start, 'length': end})
return entities
async def check_media(message, reply):
if reply and reply.media:
if reply.photo:
data = reply.photo
elif reply.document:
if reply.gif or reply.video or reply.audio or reply.voice:
return None
data = reply.media.document
else:
return None
else:
return None
if not data or data is None:
return None
else:
data = await message.client.download_file(data, bytes)
img = io.BytesIO()
img.name = "img.png"
try:
PIL.Image.open(io.BytesIO(data)).save(img, "PNG")
link = 'https://telegra.ph'+requests.post('https://telegra.ph/upload', files={'file': ('file', img.getvalue(), "image/png")}).json()[0]['src']
return link
except:
return None

View File

@@ -1,56 +1,56 @@
import os
from .. import loader, utils
from asyncio import sleep
def register(cb):
cb(ReplyDownloaderMod())
class ReplyDownloaderMod(loader.Module):
"""Скачать файлом реплай."""
strings = {'name': 'Reply Downloader'}
async def dlrcmd(self, message):
"""Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай."""
name = utils.get_args_raw(message)
reply = await message.get_reply_message()
if reply:
await message.edit('Скачиваем...')
if reply.text:
text = reply.text
fname = f'{name or message.id+reply.id}.txt'
file = open(fname, 'w')
file.write(text)
file.close()
await message.edit(f'Файл сохранён как: <code>{fname}</code>.\n\nВы можете отправить его в этот чат с помощью команды <code>.ulf {fname}</code>.')
else:
ext = reply.file.ext
fname = f'{name or message.id+reply.id}{ext}'
await message.client.download_media(reply, fname)
await message.edit(f'Этот файл сохранён как: <code>{fname}</code>.\n\nВы можете отправить его в этот чат с помощью команды <code>.ulf {fname}</code>.')
else:
return await message.edit('Нет реплая.')
async def ulfcmd(self, message):
"""Команда .ulf <d>* <название файла> отправляет файл в чат.\n* - удалить файл после отправки."""
name = utils.get_args_raw(message)
d = False
if('d ' in name):
d = True
if name:
try:
name = name.replace('d ', '')
await message.edit(f'Отправляем <code>{name}</code>...')
if d == True:
await message.client.send_file(message.to_id, f'{name}')
await message.edit(f'Отправляем <code>{name}</code>... Успешно!\nУдаляем <code>{name}</code>...')
os.remove(name)
await message.edit(f'Отправляем <code>{name}</code>... Успешно!\nУдаляем <code>{name}</code>... Успешно!')
await sleep(0.5)
else:
await message.client.send_file(message.to_id, name)
except:
return await message.edit('Такой файл не существует.')
await message.delete()
else:
import os
from .. import loader, utils
from asyncio import sleep
def register(cb):
cb(ReplyDownloaderMod())
class ReplyDownloaderMod(loader.Module):
"""Скачать файлом реплай."""
strings = {'name': 'Reply Downloader'}
async def dlrcmd(self, message):
"""Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай."""
name = utils.get_args_raw(message)
reply = await message.get_reply_message()
if reply:
await message.edit('Скачиваем...')
if reply.text:
text = reply.text
fname = f'{name or message.id+reply.id}.txt'
file = open(fname, 'w')
file.write(text)
file.close()
await message.edit(f'Файл сохранён как: <code>{fname}</code>.\n\nВы можете отправить его в этот чат с помощью команды <code>.ulf {fname}</code>.')
else:
ext = reply.file.ext
fname = f'{name or message.id+reply.id}{ext}'
await message.client.download_media(reply, fname)
await message.edit(f'Этот файл сохранён как: <code>{fname}</code>.\n\nВы можете отправить его в этот чат с помощью команды <code>.ulf {fname}</code>.')
else:
return await message.edit('Нет реплая.')
async def ulfcmd(self, message):
"""Команда .ulf <d>* <название файла> отправляет файл в чат.\n* - удалить файл после отправки."""
name = utils.get_args_raw(message)
d = False
if('d ' in name):
d = True
if name:
try:
name = name.replace('d ', '')
await message.edit(f'Отправляем <code>{name}</code>...')
if d == True:
await message.client.send_file(message.to_id, f'{name}')
await message.edit(f'Отправляем <code>{name}</code>... Успешно!\nУдаляем <code>{name}</code>...')
os.remove(name)
await message.edit(f'Отправляем <code>{name}</code>... Успешно!\nУдаляем <code>{name}</code>... Успешно!')
await sleep(0.5)
else:
await message.client.send_file(message.to_id, name)
except:
return await message.edit('Такой файл не существует.')
await message.delete()
else:
return await message.edit('Нет аргументов.')

View File

@@ -1,23 +1,23 @@
from .. import loader, utils
from telethon.errors import MessageEmptyError
def register(cb):
cb(ReverseMod())
class ReverseMod(loader.Module):
"""Реверс текста."""
strings = {'name': 'Reverse'}
async def revcmd(self, message):
"""Используй .rev <текст или реплай>."""
try:
text = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not text and not reply:
return await message.edit("Нет текста или реплая.")
if reply:
return await message.edit(f"{reply.raw_text}"[::-1])
if text:
return await message.edit(f"{text}"[::-1])
except MessageEmptyError:
from .. import loader, utils
from telethon.errors import MessageEmptyError
def register(cb):
cb(ReverseMod())
class ReverseMod(loader.Module):
"""Реверс текста."""
strings = {'name': 'Reverse'}
async def revcmd(self, message):
"""Используй .rev <текст или реплай>."""
try:
text = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not text and not reply:
return await message.edit("Нет текста или реплая.")
if reply:
return await message.edit(f"{reply.raw_text}"[::-1])
if text:
return await message.edit(f"{text}"[::-1])
except MessageEmptyError:
return await message.edit("Это не текст.")

View File

@@ -1,22 +1,22 @@
from .. import loader, utils
def register(cb):
cb(SearchMod())
class SearchMod(loader.Module):
"""Поиск контента на канале @ftgmodulesbyfl1yd"""
strings = {'name': 'SearchModules'}
async def searchcmd(self, message):
"""Используй .search <название>"""
try:
title = utils.get_args_raw(message)
if not title:
await message.edit("<b>Нет текста после команды.</b>")
else:
chat = message.input_chat
await [i async for i in message.client.iter_messages("ftgmodulesbyfl1yd", search=title)][0].forward_to(chat)
await message.delete()
except:
from .. import loader, utils
def register(cb):
cb(SearchMod())
class SearchMod(loader.Module):
"""Поиск контента на канале @ftgmodulesbyfl1yd"""
strings = {'name': 'SearchModules'}
async def searchcmd(self, message):
"""Используй .search <название>"""
try:
title = utils.get_args_raw(message)
if not title:
await message.edit("<b>Нет текста после команды.</b>")
else:
chat = message.input_chat
await [i async for i in message.client.iter_messages("ftgmodulesbyfl1yd", search=title)][0].forward_to(chat)
await message.delete()
except:
await message.edit("<b>Не удалось найти контент.</b>")

View File

@@ -1,122 +1,122 @@
from .. import loader, utils
import io
import requests
from textwrap import wrap
from PIL import Image, ImageDraw, ImageFont
def register(cb):
cb(TextOnPhotoMod())
class TextOnPhotoMod(loader.Module):
strings = {'name': 'TextOnPhoto'}
async def bottomcmd(self, message):
"""Используй: .bottom {реплай на картинку/стикер} <white/black>;ничего <текст>."""
cols = {'white': 1, 'whit': 1, 'whi': 1, 'wh': 1, 'w': 1,
'black': 2, 'blac': 2, 'bla': 2, 'bl': 2, 'b': 2}
col = 1
reply = await message.get_reply_message()
txt = utils.get_args_raw(message)
await message.edit("подождем...")
if txt in cols:
col = cols[txt]
txt = None
if not txt:
txt = "я лошара."
if not reply:
await message.edit("нет реплая на картинку/стикер.")
return
if txt.split(" ")[0] in cols:
col = cols[txt.split(" ")[0]]
txt = " ".join(txt.split(" ")[1:])
img = await phedit(reply, txt, 1, col)
output = io.BytesIO()
output.name = "клоун.png"
img.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def topcmd(self, message):
"""Используй: .top {реплай на картинку/стикер} <white/black>;ничего <текст>."""
cols = {'white': 1, 'whit': 1, 'whi': 1, 'wh': 1, 'w': 1,
'black': 2, 'blac': 2, 'bla': 2, 'bl': 2, 'b': 2}
col = 1
reply = await message.get_reply_message()
txt = utils.get_args_raw(message)
await message.edit("подождем...")
if txt in cols:
col = cols[txt]
txt = None
if not txt:
txt = "я лошара."
if not reply:
await message.edit("нет реплая на картинку/стикер.")
return
if txt.split(" ")[0] in cols:
col = cols[txt.split(" ")[0]]
txt = " ".join(txt.split(" ")[1:])
img = await phedit(reply, txt, 2, col)
output = io.BytesIO()
output.name = "клоун.png"
img.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def centercmd(self, message):
"""Используй: .center {реплай на картинку/стикер} <white/black>;ничего <текст>."""
cols = {'white': 1, 'whit': 1, 'whi': 1, 'wh': 1, 'w': 1,
'black': 2, 'blac': 2, 'bla': 2, 'bl': 2, 'b': 2}
col = 1
reply = await message.get_reply_message()
txt = utils.get_args_raw(message)
await message.edit("подождем...")
if txt in cols:
col = cols[txt]
txt = None
if not txt:
txt = "я лошара."
if not reply:
await message.edit("нет реплая на картинку/стикер.")
return
if txt.split(" ")[0] in cols:
col = cols[txt.split(" ")[0]]
txt = " ".join(txt.split(" ")[1:])
img = await phedit(reply, txt, 3, col)
output = io.BytesIO()
output.name = "клоун.png"
img.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def phedit(reply, txt, align, clr):
bytes_font = requests.get("https://github.com/Fl1yd/FTG-modules/blob/master/stuff/font3.ttf?raw=true").content
bytes_back = await reply.download_media(bytes)
font = io.BytesIO(bytes_font)
font = ImageFont.truetype(font, 72)
img = Image.open(io.BytesIO(bytes_back))
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 30))
t = text
t = t.replace("𓃐", "\n")
draw = ImageDraw.Draw(img)
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w + 20, h + 20), (0, 0, 0, 0))
draw = ImageDraw.Draw(imtext)
if clr == 2:
draw.multiline_text((10, 10), t, (0, 0, 0), font=font, align='center')
else:
draw.multiline_text((10, 10), t, (255, 255, 255), font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
if align == 1:
img.paste(imtext, ((W - w) // 2, (H - h) // 1), imtext)
if align == 2:
img.paste(imtext, ((W - w) // 2, (H - h) // 15), imtext)
if align == 3:
img.paste(imtext, ((W - w) // 2, (H - h) // 2), imtext)
from .. import loader, utils
import io
import requests
from textwrap import wrap
from PIL import Image, ImageDraw, ImageFont
def register(cb):
cb(TextOnPhotoMod())
class TextOnPhotoMod(loader.Module):
strings = {'name': 'TextOnPhoto'}
async def bottomcmd(self, message):
"""Используй: .bottom {реплай на картинку/стикер} <white/black>;ничего <текст>."""
cols = {'white': 1, 'whit': 1, 'whi': 1, 'wh': 1, 'w': 1,
'black': 2, 'blac': 2, 'bla': 2, 'bl': 2, 'b': 2}
col = 1
reply = await message.get_reply_message()
txt = utils.get_args_raw(message)
await message.edit("подождем...")
if txt in cols:
col = cols[txt]
txt = None
if not txt:
txt = "я лошара."
if not reply:
await message.edit("нет реплая на картинку/стикер.")
return
if txt.split(" ")[0] in cols:
col = cols[txt.split(" ")[0]]
txt = " ".join(txt.split(" ")[1:])
img = await phedit(reply, txt, 1, col)
output = io.BytesIO()
output.name = "клоун.png"
img.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def topcmd(self, message):
"""Используй: .top {реплай на картинку/стикер} <white/black>;ничего <текст>."""
cols = {'white': 1, 'whit': 1, 'whi': 1, 'wh': 1, 'w': 1,
'black': 2, 'blac': 2, 'bla': 2, 'bl': 2, 'b': 2}
col = 1
reply = await message.get_reply_message()
txt = utils.get_args_raw(message)
await message.edit("подождем...")
if txt in cols:
col = cols[txt]
txt = None
if not txt:
txt = "я лошара."
if not reply:
await message.edit("нет реплая на картинку/стикер.")
return
if txt.split(" ")[0] in cols:
col = cols[txt.split(" ")[0]]
txt = " ".join(txt.split(" ")[1:])
img = await phedit(reply, txt, 2, col)
output = io.BytesIO()
output.name = "клоун.png"
img.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def centercmd(self, message):
"""Используй: .center {реплай на картинку/стикер} <white/black>;ничего <текст>."""
cols = {'white': 1, 'whit': 1, 'whi': 1, 'wh': 1, 'w': 1,
'black': 2, 'blac': 2, 'bla': 2, 'bl': 2, 'b': 2}
col = 1
reply = await message.get_reply_message()
txt = utils.get_args_raw(message)
await message.edit("подождем...")
if txt in cols:
col = cols[txt]
txt = None
if not txt:
txt = "я лошара."
if not reply:
await message.edit("нет реплая на картинку/стикер.")
return
if txt.split(" ")[0] in cols:
col = cols[txt.split(" ")[0]]
txt = " ".join(txt.split(" ")[1:])
img = await phedit(reply, txt, 3, col)
output = io.BytesIO()
output.name = "клоун.png"
img.save(output, "png")
output.seek(0)
await message.client.send_file(message.to_id, output, reply_to=reply)
await message.delete()
async def phedit(reply, txt, align, clr):
bytes_font = requests.get("https://github.com/Fl1yd/FTG-modules/blob/master/stuff/font3.ttf?raw=true").content
bytes_back = await reply.download_media(bytes)
font = io.BytesIO(bytes_font)
font = ImageFont.truetype(font, 72)
img = Image.open(io.BytesIO(bytes_back))
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 30))
t = text
t = t.replace("𓃐", "\n")
draw = ImageDraw.Draw(img)
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w + 20, h + 20), (0, 0, 0, 0))
draw = ImageDraw.Draw(imtext)
if clr == 2:
draw.multiline_text((10, 10), t, (0, 0, 0), font=font, align='center')
else:
draw.multiline_text((10, 10), t, (255, 255, 255), font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
if align == 1:
img.paste(imtext, ((W - w) // 2, (H - h) // 1), imtext)
if align == 2:
img.paste(imtext, ((W - w) // 2, (H - h) // 15), imtext)
if align == 3:
img.paste(imtext, ((W - w) // 2, (H - h) // 2), imtext)
return img

View File

@@ -1,26 +1,26 @@
import requests
from .. import loader, utils
def register(cb):
cb(WeatherMod())
class WeatherMod(loader.Module):
"""Погода с сайта wttr.in"""
strings = {'name': 'Weather'}
async def pwcmd(self, message):
""""Кидает погоду картинкой.\nИспользование: .pw <город>; ничего."""
args = utils.get_args_raw(message).replace(' ', '+')
await message.edit("Узнаем погоду...")
city = requests.get(f"https://wttr.in/{args if args != None else ''}.png").content
await message.client.send_file(message.to_id, city)
await message.delete()
async def awcmd(self, message):
"""Кидает погоду ascii-артом.\nИспользование: .aw <город>; ничего."""
city = utils.get_args_raw(message)
await message.edit("Узнаем погоду...")
r = requests.get(f"https://wttr.in/{city if city != None else ''}?0?q?T&lang=ru")
import requests
from .. import loader, utils
def register(cb):
cb(WeatherMod())
class WeatherMod(loader.Module):
"""Погода с сайта wttr.in"""
strings = {'name': 'Weather'}
async def pwcmd(self, message):
""""Кидает погоду картинкой.\nИспользование: .pw <город>; ничего."""
args = utils.get_args_raw(message).replace(' ', '+')
await message.edit("Узнаем погоду...")
city = requests.get(f"https://wttr.in/{args if args != None else ''}.png").content
await message.client.send_file(message.to_id, city)
await message.delete()
async def awcmd(self, message):
"""Кидает погоду ascii-артом.\nИспользование: .aw <город>; ничего."""
city = utils.get_args_raw(message)
await message.edit("Узнаем погоду...")
r = requests.get(f"https://wttr.in/{city if city != None else ''}?0?q?T&lang=ru")
await message.edit(f"<code>Город: {r.text}</code>")

View File

@@ -1,158 +1,158 @@
from .. import loader, utils
import requests
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import io
from textwrap import wrap
def register(cb):
cb(ZapomniZabudSoglMod())
class ZapomniZabudSoglMod(loader.Module):
"""Запомните;забудьте твари, согласен."""
strings = {'name': 'Запомните;забудьте твари, согласен'}
def __init__(self):
self.name = self.strings['name']
self._me = None
self._ratelimit = []
async def client_ready(self, client, db):
self._db = db
self._client = client
self.me = await client.get_me()
async def zapcmd(self, message):
""".zap <текст или реплай>"""
ufr = requests.get("https://fl1yd.ml/modules/stuff/font.ttf")
f = ufr.content
reply = await message.get_reply_message()
txet = utils.get_args_raw(message)
if not txet:
if not reply:
await message.edit("text?")
else:
txt = reply.raw_text
else:
txt = utils.get_args_raw(message)
await message.edit("<b>Извиняюсь...</b>")
pic = requests.get("https://fl1yd.ml/modules/stuff/man.jpg")
pic.raw.decode_content = True
img = Image.open(io.BytesIO(pic.content)).convert("RGB")
black = Image.new("RGBA", img.size, (0, 0, 0, 100))
img.paste(black, (0, 0), black)
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 40))
t = "Запомните твари:\n" +text
t = t.replace("𓃐","\n")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(io.BytesIO(f), 32, encoding='UTF-8')
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w+20, h+20), (0, 0,0,0))
draw = ImageDraw.Draw(imtext)
draw.multiline_text((10, 10),t,(255,255,255),font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
img.paste(imtext, ((W-w)//2,(H-h)//2), imtext)
out = io.BytesIO()
out.name = "out.jpg"
img.save(out)
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()
async def zabcmd(self, message):
""".zab <текст или реплай>"""
ufr = requests.get("https://fl1yd.ml/modules/stuff/font.ttf")
f = ufr.content
reply = await message.get_reply_message()
txet = utils.get_args_raw(message)
if not txet:
if not reply:
await message.edit("text?")
else:
txt = reply.raw_text
else:
txt = utils.get_args_raw(message)
await message.edit("<b>Извиняюсь...</b>")
pic = requests.get("https://fl1yd.ml/modules/stuff/man.jpg")
pic.raw.decode_content = True
img = Image.open(io.BytesIO(pic.content)).convert("RGB")
black = Image.new("RGBA", img.size, (0, 0, 0, 100))
img.paste(black, (0, 0), black)
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 40))
t = "Забудьте твари:\n" + text
t = t.replace("𓃐", "\n")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(io.BytesIO(f), 32, encoding='UTF-8')
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w + 20, h + 20), (0, 0, 0, 0))
draw = ImageDraw.Draw(imtext)
draw.multiline_text((10, 10), t, (255, 255, 255), font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
img.paste(imtext, ((W - w) // 2, (H - h) // 2), imtext)
out = io.BytesIO()
out.name = "out.jpg"
img.save(out)
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()
async def soglcmd(self, message):
""".sogl <текст или реплай>"""
ufr = requests.get("https://fl1yd.ml/modules/stuff/font.ttf")
f = ufr.content
reply = await message.get_reply_message()
txet = utils.get_args_raw(message)
if not txet:
if not reply:
await message.edit("text?")
else:
txt = reply.raw_text
else:
txt = utils.get_args_raw(message)
await message.edit("<b>Извиняюсь...</b>")
pic = requests.get("https://fl1yd.ml/modules/stuff/shrek.jpg")
pic.raw.decode_content = True
img = Image.open(io.BytesIO(pic.content)).convert("RGB")
black = Image.new("RGBA", img.size, (0, 0, 0, 100))
img.paste(black, (0, 0), black)
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 40))
t = "Согласен, " + text
t = t.replace("𓃐", "\n")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(io.BytesIO(f), 28, encoding='UTF-8')
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w + 20, h + 20), (0, 0, 0, 0))
draw = ImageDraw.Draw(imtext)
draw.multiline_text((10, 10), t, (255, 255, 255), font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
img.paste(imtext, ((W - w) // 2, (H - h) // 2), imtext)
out = io.BytesIO()
out.name = "out.jpg"
img.save(out)
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
from .. import loader, utils
import requests
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import io
from textwrap import wrap
def register(cb):
cb(ZapomniZabudSoglMod())
class ZapomniZabudSoglMod(loader.Module):
"""Запомните;забудьте твари, согласен."""
strings = {'name': 'Запомните;забудьте твари, согласен'}
def __init__(self):
self.name = self.strings['name']
self._me = None
self._ratelimit = []
async def client_ready(self, client, db):
self._db = db
self._client = client
self.me = await client.get_me()
async def zapcmd(self, message):
""".zap <текст или реплай>"""
ufr = requests.get("https://fl1yd.ml/modules/stuff/font.ttf")
f = ufr.content
reply = await message.get_reply_message()
txet = utils.get_args_raw(message)
if not txet:
if not reply:
await message.edit("text?")
else:
txt = reply.raw_text
else:
txt = utils.get_args_raw(message)
await message.edit("<b>Извиняюсь...</b>")
pic = requests.get("https://fl1yd.ml/modules/stuff/man.jpg")
pic.raw.decode_content = True
img = Image.open(io.BytesIO(pic.content)).convert("RGB")
black = Image.new("RGBA", img.size, (0, 0, 0, 100))
img.paste(black, (0, 0), black)
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 40))
t = "Запомните твари:\n" +text
t = t.replace("𓃐","\n")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(io.BytesIO(f), 32, encoding='UTF-8')
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w+20, h+20), (0, 0,0,0))
draw = ImageDraw.Draw(imtext)
draw.multiline_text((10, 10),t,(255,255,255),font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
img.paste(imtext, ((W-w)//2,(H-h)//2), imtext)
out = io.BytesIO()
out.name = "out.jpg"
img.save(out)
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()
async def zabcmd(self, message):
""".zab <текст или реплай>"""
ufr = requests.get("https://fl1yd.ml/modules/stuff/font.ttf")
f = ufr.content
reply = await message.get_reply_message()
txet = utils.get_args_raw(message)
if not txet:
if not reply:
await message.edit("text?")
else:
txt = reply.raw_text
else:
txt = utils.get_args_raw(message)
await message.edit("<b>Извиняюсь...</b>")
pic = requests.get("https://fl1yd.ml/modules/stuff/man.jpg")
pic.raw.decode_content = True
img = Image.open(io.BytesIO(pic.content)).convert("RGB")
black = Image.new("RGBA", img.size, (0, 0, 0, 100))
img.paste(black, (0, 0), black)
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 40))
t = "Забудьте твари:\n" + text
t = t.replace("𓃐", "\n")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(io.BytesIO(f), 32, encoding='UTF-8')
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w + 20, h + 20), (0, 0, 0, 0))
draw = ImageDraw.Draw(imtext)
draw.multiline_text((10, 10), t, (255, 255, 255), font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
img.paste(imtext, ((W - w) // 2, (H - h) // 2), imtext)
out = io.BytesIO()
out.name = "out.jpg"
img.save(out)
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()
async def soglcmd(self, message):
""".sogl <текст или реплай>"""
ufr = requests.get("https://fl1yd.ml/modules/stuff/font.ttf")
f = ufr.content
reply = await message.get_reply_message()
txet = utils.get_args_raw(message)
if not txet:
if not reply:
await message.edit("text?")
else:
txt = reply.raw_text
else:
txt = utils.get_args_raw(message)
await message.edit("<b>Извиняюсь...</b>")
pic = requests.get("https://fl1yd.ml/modules/stuff/shrek.jpg")
pic.raw.decode_content = True
img = Image.open(io.BytesIO(pic.content)).convert("RGB")
black = Image.new("RGBA", img.size, (0, 0, 0, 100))
img.paste(black, (0, 0), black)
W, H = img.size
txt = txt.replace("\n", "𓃐")
text = "\n".join(wrap(txt, 40))
t = "Согласен, " + text
t = t.replace("𓃐", "\n")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(io.BytesIO(f), 28, encoding='UTF-8')
w, h = draw.multiline_textsize(t, font=font)
imtext = Image.new("RGBA", (w + 20, h + 20), (0, 0, 0, 0))
draw = ImageDraw.Draw(imtext)
draw.multiline_text((10, 10), t, (255, 255, 255), font=font, align='center')
imtext.thumbnail((W, H))
w, h = imtext.size
img.paste(imtext, ((W - w) // 2, (H - h) // 2), imtext)
out = io.BytesIO()
out.name = "out.jpg"
img.save(out)
out.seek(0)
await message.client.send_file(message.to_id, out, reply_to=reply)
await message.delete()