mirror of
https://github.com/MuRuLOSE/limoka.git
synced 2026-06-16 14:34:17 +02:00
Added and updated repositories 2025-07-11 08:27:20
This commit is contained in:
@@ -1,223 +1,223 @@
|
||||
# .------.------.------.------.------.------.------.------.------.------.
|
||||
# |D.--. |4.--. |N.--. |1.--. |3.--. |L.--. |3.--. |K.--. |0.--. |0.--. |
|
||||
# | :/\: | :/\: | :(): | :/\: | :(): | :/\: | :(): | :/\: | :/\: | :/\: |
|
||||
# | (__) | :\/: | ()() | (__) | ()() | (__) | ()() | :\/: | :\/: | :\/: |
|
||||
# | '--'D| '--'4| '--'N| '--'1| '--'3| '--'L| '--'3| '--'K| '--'0| '--'0|
|
||||
# `------`------`------`------`------`------`------`------`------`------'
|
||||
#
|
||||
# Copyright 2023 t.me/D4n13l3k00
|
||||
# Licensed under the Creative Commons CC BY-NC-ND 4.0
|
||||
#
|
||||
# Full license text can be found at:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
|
||||
#
|
||||
# Human-friendly one:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import re
|
||||
from typing import *
|
||||
|
||||
import pytgcalls
|
||||
import youtube_dl
|
||||
from pytgcalls import PyTgCalls, StreamType
|
||||
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
||||
from pytgcalls.types.input_stream.quality import HighQualityAudio, HighQualityVideo
|
||||
from telethon import types
|
||||
|
||||
from .. import loader, utils # type: ignore
|
||||
|
||||
# meta developer: @D4n13l3k00
|
||||
# requires: py-tgcalls youtube-dl
|
||||
|
||||
|
||||
@loader.tds
|
||||
class ChatVoiceMod(loader.Module):
|
||||
"""Module for working with voicechat"""
|
||||
|
||||
strings = {
|
||||
"name": "ChatVoiceMod",
|
||||
"downloading": "<b>[ChatVoiceMod]</b> Downloading...",
|
||||
"playing": "<b>[ChatVoiceMod]</b> Playing...",
|
||||
"notjoined": "<b>[ChatVoiceMod]</b> You are not joined",
|
||||
"stop": "<b>[ChatVoiceMod]</b> Playing stopped!",
|
||||
"leave": "<b>[ChatVoiceMod]</b> Leaved!",
|
||||
"pause": "<b>[ChatVoiceMod]</b> Paused!",
|
||||
"resume": "<b>[ChatVoiceMod]</b> Resumed!",
|
||||
"mute": "<b>[ChatVoiceMod]</b> Muted!",
|
||||
"unmute": "<b>[ChatVoiceMod]</b> Unmuted!",
|
||||
"error": "<b>[ChatVoiceMod]</b> Error: <code>{}</code>",
|
||||
"noargs": "<b>[ChatVoiceMod]</b> No args",
|
||||
"noreply": "<b>[ChatVoiceMod]</b> No reply",
|
||||
"nofile": "<b>[ChatVoiceMod]</b> No file",
|
||||
"nofiles": "<b>[ChatVoiceMod]</b> No files",
|
||||
"deleted": "<b>[ChatVoiceMod]</b> <code>{}</code> successfully deleted",
|
||||
"downloaded": "<b>[ChatVoiceMod]</b> Downloaded to <code>dl/{0}</code>. For playing use:\n<code>.cplaya dl/{0}</code>\n<code>.cplayv dl/{0}</code>",
|
||||
}
|
||||
|
||||
async def client_ready(self, client, _):
|
||||
self.client = client
|
||||
self.call = PyTgCalls(client)
|
||||
|
||||
@self.call.on_stream_end()
|
||||
async def _(_, update):
|
||||
with contextlib.suppress(Exception):
|
||||
await self.call.leave_group_call(update.chat_id)
|
||||
|
||||
await self.call.start()
|
||||
|
||||
async def parse_args(self, args):
|
||||
if not args or not re.match(
|
||||
r"http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?",
|
||||
args,
|
||||
):
|
||||
return args
|
||||
with youtube_dl.YoutubeDL({"format": "best"}) as ydl:
|
||||
info = ydl.extract_info(args, download=False)
|
||||
return info["formats"][0]["url"]
|
||||
|
||||
async def cdlcmd(self, m: types.Message):
|
||||
"<reply_to_media> <name: optional> - Download media to server in `dl` folder"
|
||||
args = utils.get_args_raw(m)
|
||||
reply = await m.get_reply_message()
|
||||
if not reply:
|
||||
return await utils.answer(m, self.strings("noreply"))
|
||||
name = args or reply.file.name
|
||||
try:
|
||||
m = await utils.answer(m, self.strings("downloading"))
|
||||
await reply.download_media(f"dl/{name}")
|
||||
await utils.answer(m, self.strings("downloaded").format(name))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def clscmd(self, m: types.Message):
|
||||
"List all files in `dl` folder"
|
||||
if not os.path.isdir("dl") or not os.listdir("dl"):
|
||||
return await utils.answer(m, self.strings("nofiles"))
|
||||
files = [f"<code>dl/{f}</code>" for f in os.listdir("dl")]
|
||||
await utils.answer(m, "\n".join(files))
|
||||
|
||||
# command for deleting file from dl folder
|
||||
async def cdelcmd(self, m: types.Message):
|
||||
"<name> - Delete file from `dl` folder"
|
||||
args = utils.get_args_raw(m)
|
||||
if not args:
|
||||
return await utils.answer(m, self.strings("noargs"))
|
||||
if not args.startswith("dl/"):
|
||||
args = f"dl/{args}"
|
||||
if not os.path.isfile(f"{args}"):
|
||||
return await utils.answer(m, self.strings("nofile"))
|
||||
try:
|
||||
os.remove(f"{args}")
|
||||
await utils.answer(m, self.strings("deleted").format(args))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cplayvcmd(self, m: types.Message):
|
||||
"<link/path/reply_to_video> - Play video in voice chat"
|
||||
try:
|
||||
reply = await m.get_reply_message()
|
||||
path = await self.parse_args(utils.get_args_raw(m))
|
||||
chat = m.chat.id
|
||||
if not path:
|
||||
if not reply:
|
||||
return await utils.answer(m, self.strings("noargs"))
|
||||
m = await utils.answer(m, self.strings("downloading"))
|
||||
path = await reply.download_media()
|
||||
with contextlib.suppress(pytgcalls.exceptions.GroupCallNotFound):
|
||||
self.call.get_active_call(chat)
|
||||
await self.call.leave_group_call(chat)
|
||||
await self.call.join_group_call(
|
||||
chat,
|
||||
AudioVideoPiped(
|
||||
path,
|
||||
HighQualityAudio(),
|
||||
HighQualityVideo(),
|
||||
),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
await utils.answer(m, self.strings("playing"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cplayacmd(self, m: types.Message):
|
||||
"<link/path/reply_to_audio> - Play audio in voice chat"
|
||||
try:
|
||||
reply = await m.get_reply_message()
|
||||
path = await self.parse_args(utils.get_args_raw(m))
|
||||
chat = m.chat.id
|
||||
if not path:
|
||||
if not reply:
|
||||
return await utils.answer(m, self.strings("noargs"))
|
||||
m = await utils.answer(m, self.strings("downloading"))
|
||||
path = await reply.download_media()
|
||||
with contextlib.suppress(pytgcalls.exceptions.GroupCallNotFound):
|
||||
self.call.get_active_call(chat)
|
||||
await self.call.leave_group_call(chat)
|
||||
await self.call.join_group_call(
|
||||
chat,
|
||||
AudioPiped(
|
||||
path,
|
||||
HighQualityAudio(),
|
||||
),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
await utils.answer(m, self.strings("playing"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cleavecmd(self, m: types.Message):
|
||||
"Leave"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.leave_group_call(m.chat.id)
|
||||
await utils.answer(m, self.strings("leave"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cmutecmd(self, m: types.Message):
|
||||
"Mute"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.mute_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("mute"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cunmutecmd(self, m: types.Message):
|
||||
"Unmute"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.unmute_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("unmute"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cpausecmd(self, m: types.Message):
|
||||
"Pause"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.pause_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("pause"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cresumecmd(self, m: types.Message):
|
||||
"Resume"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.resume_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("resume"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
# .------.------.------.------.------.------.------.------.------.------.
|
||||
# |D.--. |4.--. |N.--. |1.--. |3.--. |L.--. |3.--. |K.--. |0.--. |0.--. |
|
||||
# | :/\: | :/\: | :(): | :/\: | :(): | :/\: | :(): | :/\: | :/\: | :/\: |
|
||||
# | (__) | :\/: | ()() | (__) | ()() | (__) | ()() | :\/: | :\/: | :\/: |
|
||||
# | '--'D| '--'4| '--'N| '--'1| '--'3| '--'L| '--'3| '--'K| '--'0| '--'0|
|
||||
# `------`------`------`------`------`------`------`------`------`------'
|
||||
#
|
||||
# Copyright 2023 t.me/D4n13l3k00
|
||||
# Licensed under the Creative Commons CC BY-NC-ND 4.0
|
||||
#
|
||||
# Full license text can be found at:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
|
||||
#
|
||||
# Human-friendly one:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import re
|
||||
from typing import *
|
||||
|
||||
import pytgcalls
|
||||
import youtube_dl
|
||||
from pytgcalls import PyTgCalls, StreamType
|
||||
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
||||
from pytgcalls.types.input_stream.quality import HighQualityAudio, HighQualityVideo
|
||||
from telethon import types
|
||||
|
||||
from .. import loader, utils # type: ignore
|
||||
|
||||
# meta developer: @D4n13l3k00
|
||||
# requires: py-tgcalls youtube-dl
|
||||
|
||||
|
||||
@loader.tds
|
||||
class ChatVoiceMod(loader.Module):
|
||||
"""Module for working with voicechat"""
|
||||
|
||||
strings = {
|
||||
"name": "ChatVoiceMod",
|
||||
"downloading": "<b>[ChatVoiceMod]</b> Downloading...",
|
||||
"playing": "<b>[ChatVoiceMod]</b> Playing...",
|
||||
"notjoined": "<b>[ChatVoiceMod]</b> You are not joined",
|
||||
"stop": "<b>[ChatVoiceMod]</b> Playing stopped!",
|
||||
"leave": "<b>[ChatVoiceMod]</b> Leaved!",
|
||||
"pause": "<b>[ChatVoiceMod]</b> Paused!",
|
||||
"resume": "<b>[ChatVoiceMod]</b> Resumed!",
|
||||
"mute": "<b>[ChatVoiceMod]</b> Muted!",
|
||||
"unmute": "<b>[ChatVoiceMod]</b> Unmuted!",
|
||||
"error": "<b>[ChatVoiceMod]</b> Error: <code>{}</code>",
|
||||
"noargs": "<b>[ChatVoiceMod]</b> No args",
|
||||
"noreply": "<b>[ChatVoiceMod]</b> No reply",
|
||||
"nofile": "<b>[ChatVoiceMod]</b> No file",
|
||||
"nofiles": "<b>[ChatVoiceMod]</b> No files",
|
||||
"deleted": "<b>[ChatVoiceMod]</b> <code>{}</code> successfully deleted",
|
||||
"downloaded": "<b>[ChatVoiceMod]</b> Downloaded to <code>dl/{0}</code>. For playing use:\n<code>.cplaya dl/{0}</code>\n<code>.cplayv dl/{0}</code>",
|
||||
}
|
||||
|
||||
async def client_ready(self, client, _):
|
||||
self.client = client
|
||||
self.call = PyTgCalls(client)
|
||||
|
||||
@self.call.on_stream_end()
|
||||
async def _(_, update):
|
||||
with contextlib.suppress(Exception):
|
||||
await self.call.leave_group_call(update.chat_id)
|
||||
|
||||
await self.call.start()
|
||||
|
||||
async def parse_args(self, args):
|
||||
if not args or not re.match(
|
||||
r"http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?",
|
||||
args,
|
||||
):
|
||||
return args
|
||||
with youtube_dl.YoutubeDL({"format": "best"}) as ydl:
|
||||
info = ydl.extract_info(args, download=False)
|
||||
return info["formats"][0]["url"]
|
||||
|
||||
async def cdlcmd(self, m: types.Message):
|
||||
"<reply_to_media> <name: optional> - Download media to server in `dl` folder"
|
||||
args = utils.get_args_raw(m)
|
||||
reply = await m.get_reply_message()
|
||||
if not reply:
|
||||
return await utils.answer(m, self.strings("noreply"))
|
||||
name = args or reply.file.name
|
||||
try:
|
||||
m = await utils.answer(m, self.strings("downloading"))
|
||||
await reply.download_media(f"dl/{name}")
|
||||
await utils.answer(m, self.strings("downloaded").format(name))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def clscmd(self, m: types.Message):
|
||||
"List all files in `dl` folder"
|
||||
if not os.path.isdir("dl") or not os.listdir("dl"):
|
||||
return await utils.answer(m, self.strings("nofiles"))
|
||||
files = [f"<code>dl/{f}</code>" for f in os.listdir("dl")]
|
||||
await utils.answer(m, "\n".join(files))
|
||||
|
||||
# command for deleting file from dl folder
|
||||
async def cdelcmd(self, m: types.Message):
|
||||
"<name> - Delete file from `dl` folder"
|
||||
args = utils.get_args_raw(m)
|
||||
if not args:
|
||||
return await utils.answer(m, self.strings("noargs"))
|
||||
if not args.startswith("dl/"):
|
||||
args = f"dl/{args}"
|
||||
if not os.path.isfile(f"{args}"):
|
||||
return await utils.answer(m, self.strings("nofile"))
|
||||
try:
|
||||
os.remove(f"{args}")
|
||||
await utils.answer(m, self.strings("deleted").format(args))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cplayvcmd(self, m: types.Message):
|
||||
"<link/path/reply_to_video> - Play video in voice chat"
|
||||
try:
|
||||
reply = await m.get_reply_message()
|
||||
path = await self.parse_args(utils.get_args_raw(m))
|
||||
chat = m.chat.id
|
||||
if not path:
|
||||
if not reply:
|
||||
return await utils.answer(m, self.strings("noargs"))
|
||||
m = await utils.answer(m, self.strings("downloading"))
|
||||
path = await reply.download_media()
|
||||
with contextlib.suppress(pytgcalls.exceptions.GroupCallNotFound):
|
||||
self.call.get_active_call(chat)
|
||||
await self.call.leave_group_call(chat)
|
||||
await self.call.join_group_call(
|
||||
chat,
|
||||
AudioVideoPiped(
|
||||
path,
|
||||
HighQualityAudio(),
|
||||
HighQualityVideo(),
|
||||
),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
await utils.answer(m, self.strings("playing"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cplayacmd(self, m: types.Message):
|
||||
"<link/path/reply_to_audio> - Play audio in voice chat"
|
||||
try:
|
||||
reply = await m.get_reply_message()
|
||||
path = await self.parse_args(utils.get_args_raw(m))
|
||||
chat = m.chat.id
|
||||
if not path:
|
||||
if not reply:
|
||||
return await utils.answer(m, self.strings("noargs"))
|
||||
m = await utils.answer(m, self.strings("downloading"))
|
||||
path = await reply.download_media()
|
||||
with contextlib.suppress(pytgcalls.exceptions.GroupCallNotFound):
|
||||
self.call.get_active_call(chat)
|
||||
await self.call.leave_group_call(chat)
|
||||
await self.call.join_group_call(
|
||||
chat,
|
||||
AudioPiped(
|
||||
path,
|
||||
HighQualityAudio(),
|
||||
),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
await utils.answer(m, self.strings("playing"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cleavecmd(self, m: types.Message):
|
||||
"Leave"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.leave_group_call(m.chat.id)
|
||||
await utils.answer(m, self.strings("leave"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cmutecmd(self, m: types.Message):
|
||||
"Mute"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.mute_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("mute"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cunmutecmd(self, m: types.Message):
|
||||
"Unmute"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.unmute_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("unmute"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cpausecmd(self, m: types.Message):
|
||||
"Pause"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.pause_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("pause"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
async def cresumecmd(self, m: types.Message):
|
||||
"Resume"
|
||||
try:
|
||||
self.call.get_active_call(m.chat.id)
|
||||
await self.call.resume_stream(m.chat.id)
|
||||
await utils.answer(m, self.strings("resume"))
|
||||
except pytgcalls.exceptions.GroupCallNotFound:
|
||||
await utils.answer(m, self.strings("notjoined"))
|
||||
except Exception as e:
|
||||
await utils.answer(m, self.strings("error").format(str(e)))
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
# .------.------.------.------.------.------.------.------.------.------.
|
||||
# |D.--. |4.--. |N.--. |1.--. |3.--. |L.--. |3.--. |K.--. |0.--. |0.--. |
|
||||
# | :/\: | :/\: | :(): | :/\: | :(): | :/\: | :(): | :/\: | :/\: | :/\: |
|
||||
# | (__) | :\/: | ()() | (__) | ()() | (__) | ()() | :\/: | :\/: | :\/: |
|
||||
# | '--'D| '--'4| '--'N| '--'1| '--'3| '--'L| '--'3| '--'K| '--'0| '--'0|
|
||||
# `------`------`------`------`------`------`------`------`------`------'
|
||||
#
|
||||
# Copyright 2023 t.me/D4n13l3k00
|
||||
# Licensed under the Creative Commons CC BY-NC-ND 4.0
|
||||
#
|
||||
# Full license text can be found at:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
|
||||
#
|
||||
# Human-friendly one:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0
|
||||
|
||||
# meta developer: @D4n13l3k00
|
||||
|
||||
|
||||
import contextlib
|
||||
from random import choice
|
||||
|
||||
from telethon import functions
|
||||
|
||||
from .. import loader # type: ignore
|
||||
|
||||
|
||||
@loader.tds
|
||||
class ReactionsMod(loader.Module):
|
||||
"Telegram reactions"
|
||||
|
||||
strings = {"name": __doc__}
|
||||
|
||||
async def client_ready(self, client, _):
|
||||
self.client = client
|
||||
|
||||
def reaction(func):
|
||||
async def wrapper(self, *args):
|
||||
"<reply>"
|
||||
message = args[0]
|
||||
emoji = await func(self)
|
||||
if reply := await message.get_reply_message():
|
||||
with contextlib.suppress(Exception):
|
||||
await self.client(
|
||||
functions.messages.SendReactionRequest(
|
||||
reply.peer_id, reply.id, reaction=emoji
|
||||
)
|
||||
)
|
||||
if message.out:
|
||||
await message.delete()
|
||||
|
||||
return wrapper
|
||||
|
||||
@reaction
|
||||
async def randrcmd(self):
|
||||
return choice("👍👎❤️🔥🎉🤩😱😁😢💩🤮🥰🤯🤔🤬👏")
|
||||
|
||||
@reaction
|
||||
async def lovecmd(self):
|
||||
return "❤"
|
||||
|
||||
@reaction
|
||||
async def sadcmd(self):
|
||||
return "😢"
|
||||
|
||||
@reaction
|
||||
async def nastycmd(self):
|
||||
return "🤮"
|
||||
|
||||
@reaction
|
||||
async def cutecmd(self):
|
||||
return "🥰"
|
||||
|
||||
@reaction
|
||||
async def clapcmd(self):
|
||||
return "👏"
|
||||
|
||||
@reaction
|
||||
async def fuckcmd(self):
|
||||
return "🤬"
|
||||
|
||||
@reaction
|
||||
async def wtfcmd(self):
|
||||
return "🤯"
|
||||
|
||||
@reaction
|
||||
async def hmmcmd(self):
|
||||
return "🤔"
|
||||
|
||||
@reaction
|
||||
async def hooraycmd(self):
|
||||
return "🎉"
|
||||
|
||||
@reaction
|
||||
async def likecmd(self):
|
||||
return "👍"
|
||||
|
||||
@reaction
|
||||
async def dislikecmd(self):
|
||||
return "👎"
|
||||
|
||||
@reaction
|
||||
async def firecmd(self):
|
||||
return "🔥"
|
||||
|
||||
@reaction
|
||||
async def omgcmd(self):
|
||||
return "😱"
|
||||
|
||||
@reaction
|
||||
async def wowcmd(self):
|
||||
return "🤩"
|
||||
|
||||
@reaction
|
||||
async def hehecmd(self):
|
||||
return "😁"
|
||||
|
||||
@reaction
|
||||
async def shitcmd(self):
|
||||
return "💩"
|
||||
# .------.------.------.------.------.------.------.------.------.------.
|
||||
# |D.--. |4.--. |N.--. |1.--. |3.--. |L.--. |3.--. |K.--. |0.--. |0.--. |
|
||||
# | :/\: | :/\: | :(): | :/\: | :(): | :/\: | :(): | :/\: | :/\: | :/\: |
|
||||
# | (__) | :\/: | ()() | (__) | ()() | (__) | ()() | :\/: | :\/: | :\/: |
|
||||
# | '--'D| '--'4| '--'N| '--'1| '--'3| '--'L| '--'3| '--'K| '--'0| '--'0|
|
||||
# `------`------`------`------`------`------`------`------`------`------'
|
||||
#
|
||||
# Copyright 2023 t.me/D4n13l3k00
|
||||
# Licensed under the Creative Commons CC BY-NC-ND 4.0
|
||||
#
|
||||
# Full license text can be found at:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
|
||||
#
|
||||
# Human-friendly one:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0
|
||||
|
||||
# meta developer: @D4n13l3k00
|
||||
|
||||
|
||||
import contextlib
|
||||
from random import choice
|
||||
|
||||
from telethon import functions
|
||||
|
||||
from .. import loader # type: ignore
|
||||
|
||||
|
||||
@loader.tds
|
||||
class ReactionsMod(loader.Module):
|
||||
"Telegram reactions"
|
||||
|
||||
strings = {"name": __doc__}
|
||||
|
||||
async def client_ready(self, client, _):
|
||||
self.client = client
|
||||
|
||||
def reaction(func):
|
||||
async def wrapper(self, *args):
|
||||
"<reply>"
|
||||
message = args[0]
|
||||
emoji = await func(self)
|
||||
if reply := await message.get_reply_message():
|
||||
with contextlib.suppress(Exception):
|
||||
await self.client(
|
||||
functions.messages.SendReactionRequest(
|
||||
reply.peer_id, reply.id, reaction=emoji
|
||||
)
|
||||
)
|
||||
if message.out:
|
||||
await message.delete()
|
||||
|
||||
return wrapper
|
||||
|
||||
@reaction
|
||||
async def randrcmd(self):
|
||||
return choice("👍👎❤️🔥🎉🤩😱😁😢💩🤮🥰🤯🤔🤬👏")
|
||||
|
||||
@reaction
|
||||
async def lovecmd(self):
|
||||
return "❤"
|
||||
|
||||
@reaction
|
||||
async def sadcmd(self):
|
||||
return "😢"
|
||||
|
||||
@reaction
|
||||
async def nastycmd(self):
|
||||
return "🤮"
|
||||
|
||||
@reaction
|
||||
async def cutecmd(self):
|
||||
return "🥰"
|
||||
|
||||
@reaction
|
||||
async def clapcmd(self):
|
||||
return "👏"
|
||||
|
||||
@reaction
|
||||
async def fuckcmd(self):
|
||||
return "🤬"
|
||||
|
||||
@reaction
|
||||
async def wtfcmd(self):
|
||||
return "🤯"
|
||||
|
||||
@reaction
|
||||
async def hmmcmd(self):
|
||||
return "🤔"
|
||||
|
||||
@reaction
|
||||
async def hooraycmd(self):
|
||||
return "🎉"
|
||||
|
||||
@reaction
|
||||
async def likecmd(self):
|
||||
return "👍"
|
||||
|
||||
@reaction
|
||||
async def dislikecmd(self):
|
||||
return "👎"
|
||||
|
||||
@reaction
|
||||
async def firecmd(self):
|
||||
return "🔥"
|
||||
|
||||
@reaction
|
||||
async def omgcmd(self):
|
||||
return "😱"
|
||||
|
||||
@reaction
|
||||
async def wowcmd(self):
|
||||
return "🤩"
|
||||
|
||||
@reaction
|
||||
async def hehecmd(self):
|
||||
return "😁"
|
||||
|
||||
@reaction
|
||||
async def shitcmd(self):
|
||||
return "💩"
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
# .------.------.------.------.------.------.------.------.------.------.
|
||||
# |D.--. |4.--. |N.--. |1.--. |3.--. |L.--. |3.--. |K.--. |0.--. |0.--. |
|
||||
# | :/\: | :/\: | :(): | :/\: | :(): | :/\: | :(): | :/\: | :/\: | :/\: |
|
||||
# | (__) | :\/: | ()() | (__) | ()() | (__) | ()() | :\/: | :\/: | :\/: |
|
||||
# | '--'D| '--'4| '--'N| '--'1| '--'3| '--'L| '--'3| '--'K| '--'0| '--'0|
|
||||
# `------`------`------`------`------`------`------`------`------`------'
|
||||
#
|
||||
# Copyright 2023 t.me/D4n13l3k00
|
||||
# Licensed under the Creative Commons CC BY-NC-ND 4.0
|
||||
#
|
||||
# Full license text can be found at:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
|
||||
#
|
||||
# Human-friendly one:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0
|
||||
|
||||
# meta developer: @D4n13l3k00
|
||||
|
||||
import io
|
||||
|
||||
from telethon import types
|
||||
|
||||
from .. import loader, utils # type: ignore
|
||||
|
||||
|
||||
@loader.tds
|
||||
class SaverMod(loader.Module):
|
||||
strings = {"name": "Saver"}
|
||||
|
||||
async def client_ready(self, client, db):
|
||||
self.db = db
|
||||
|
||||
@loader.owner
|
||||
async def бляcmd(self, m: types.Message):
|
||||
".бля <reply> - скачать самоуничтожающееся фото"
|
||||
reply = await m.get_reply_message()
|
||||
if not reply or not reply.media or not reply.media.ttl_seconds:
|
||||
return await m.edit("бля")
|
||||
await m.delete()
|
||||
new = io.BytesIO(await reply.download_media(bytes))
|
||||
new.name = reply.file.name
|
||||
await m.client.send_file("me", new)
|
||||
|
||||
@loader.owner
|
||||
async def swбляcmd(self, m: types.Message):
|
||||
"Переключить режим автозагрузки фото в лс"
|
||||
new_val = not self.db.get("Saver", "state", False)
|
||||
self.db.set("Saver", "state", new_val)
|
||||
await utils.answer(m, f"<b>[Saver]</b> <pre>{new_val}</pre>")
|
||||
|
||||
async def watcher(self, m: types.Message):
|
||||
if (
|
||||
m
|
||||
and m.media
|
||||
and m.media.ttl_seconds
|
||||
and self.db.get("Saver", "state", False)
|
||||
):
|
||||
new = io.BytesIO(await m.download_media(bytes))
|
||||
new.name = m.file.name
|
||||
await m.client.send_file(
|
||||
"me",
|
||||
new,
|
||||
caption=f"<b>[Saver] Фото от</b> {f'@{m.sender.username}' if m.sender.username else m.sender.first_name} | <pre>{m.sender.id}</pre>\n"
|
||||
f"Время жизни: <code>{m.media.ttl_seconds}sec</code>",
|
||||
)
|
||||
# .------.------.------.------.------.------.------.------.------.------.
|
||||
# |D.--. |4.--. |N.--. |1.--. |3.--. |L.--. |3.--. |K.--. |0.--. |0.--. |
|
||||
# | :/\: | :/\: | :(): | :/\: | :(): | :/\: | :(): | :/\: | :/\: | :/\: |
|
||||
# | (__) | :\/: | ()() | (__) | ()() | (__) | ()() | :\/: | :\/: | :\/: |
|
||||
# | '--'D| '--'4| '--'N| '--'1| '--'3| '--'L| '--'3| '--'K| '--'0| '--'0|
|
||||
# `------`------`------`------`------`------`------`------`------`------'
|
||||
#
|
||||
# Copyright 2023 t.me/D4n13l3k00
|
||||
# Licensed under the Creative Commons CC BY-NC-ND 4.0
|
||||
#
|
||||
# Full license text can be found at:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
|
||||
#
|
||||
# Human-friendly one:
|
||||
# https://creativecommons.org/licenses/by-nc-nd/4.0
|
||||
|
||||
# meta developer: @D4n13l3k00
|
||||
|
||||
import io
|
||||
|
||||
from telethon import types
|
||||
|
||||
from .. import loader, utils # type: ignore
|
||||
|
||||
|
||||
@loader.tds
|
||||
class SaverMod(loader.Module):
|
||||
strings = {"name": "Saver"}
|
||||
|
||||
async def client_ready(self, client, db):
|
||||
self.db = db
|
||||
|
||||
@loader.owner
|
||||
async def бляcmd(self, m: types.Message):
|
||||
".бля <reply> - скачать самоуничтожающееся фото"
|
||||
reply = await m.get_reply_message()
|
||||
if not reply or not reply.media or not reply.media.ttl_seconds:
|
||||
return await m.edit("бля")
|
||||
await m.delete()
|
||||
new = io.BytesIO(await reply.download_media(bytes))
|
||||
new.name = reply.file.name
|
||||
await m.client.send_file("me", new)
|
||||
|
||||
@loader.owner
|
||||
async def swбляcmd(self, m: types.Message):
|
||||
"Переключить режим автозагрузки фото в лс"
|
||||
new_val = not self.db.get("Saver", "state", False)
|
||||
self.db.set("Saver", "state", new_val)
|
||||
await utils.answer(m, f"<b>[Saver]</b> <pre>{new_val}</pre>")
|
||||
|
||||
async def watcher(self, m: types.Message):
|
||||
if (
|
||||
m
|
||||
and m.media
|
||||
and m.media.ttl_seconds
|
||||
and self.db.get("Saver", "state", False)
|
||||
):
|
||||
new = io.BytesIO(await m.download_media(bytes))
|
||||
new.name = m.file.name
|
||||
await m.client.send_file(
|
||||
"me",
|
||||
new,
|
||||
caption=f"<b>[Saver] Фото от</b> {f'@{m.sender.username}' if m.sender.username else m.sender.first_name} | <pre>{m.sender.id}</pre>\n"
|
||||
f"Время жизни: <code>{m.media.ttl_seconds}sec</code>",
|
||||
)
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
**Describe the bug**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
---
|
||||
|
||||
**To Reproduce**
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
1. Run '...'
|
||||
2. Do '....'
|
||||
3. See error
|
||||
|
||||
---
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
---
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
---
|
||||
|
||||
**Please complete the following information:**
|
||||
- OS: [e.g. Ubuntu Server 20.04 LTS or Android 12 Termux]
|
||||
- Userbot: [e.g. GeekTG Userbot `git rev-parse HEAD`]
|
||||
|
||||
---
|
||||
|
||||
**Additional context**
|
||||
|
||||
Add any other context about the problem here.
|
||||
**Describe the bug**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
---
|
||||
|
||||
**To Reproduce**
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
1. Run '...'
|
||||
2. Do '....'
|
||||
3. See error
|
||||
|
||||
---
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
---
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
---
|
||||
|
||||
**Please complete the following information:**
|
||||
- OS: [e.g. Ubuntu Server 20.04 LTS or Android 12 Termux]
|
||||
- Userbot: [e.g. GeekTG Userbot `git rev-parse HEAD`]
|
||||
|
||||
---
|
||||
|
||||
**Additional context**
|
||||
|
||||
Add any other context about the problem here.
|
||||
|
||||
0
D4n13l3k00/FTG-Modules/format.sh
Normal file → Executable file
0
D4n13l3k00/FTG-Modules/format.sh
Normal file → Executable file
Reference in New Issue
Block a user