-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
218 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ kickall | |
moduleslink | ||
notes | ||
quotes | ||
randomreact | ||
reverse | ||
saver | ||
speedtest | ||
tagall | ||
userdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Sh1t-UB (telegram userbot by sh1tn3t) | ||
# Copyright (C) 2021-2022 Sh1tN3t | ||
|
||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import logging | ||
import random | ||
|
||
from pyrogram import Client, types, filters, errors | ||
from .. import loader, utils | ||
|
||
|
||
@loader.module("RandomReact", "sh1tn3t") | ||
class RandomReactMod(loader.Module): | ||
"""Ставит реакции рандомные реакции""" | ||
|
||
async def react_cmd(self, app: Client, message: types.Message, args: str): | ||
"""Включить/выключить рандомные реакции. Использование: react [шанс (в %, от 1 до 100)]""" | ||
chat = message.chat | ||
if chat.type not in ["group", "supergroup"]: | ||
return await utils.answer( | ||
message, "❌ <b>Это не чат</b>") | ||
|
||
chats = self.db.get("RandomReact", "chats", {}) | ||
if args or not chats.get(str(chat.id)): | ||
chance = ( | ||
int(args) if args.isdigit() and 0 < int(args) <= 100 | ||
else 30 | ||
) | ||
chats[str(chat.id)] = { | ||
"on": True, | ||
"chance": chance, | ||
"reactions": (await app.get_chat(chat.id)).available_reactions | ||
} | ||
|
||
self.db.set("RandomReact", "chats", chats) | ||
return await utils.answer( | ||
message, f"👍🏿 <b>Автоматическое выставление реакций включено!</b>\n" | ||
f"Шанс срабатывания: <b>{chance}</b>%" | ||
) | ||
|
||
del chats[str(chat.id)] | ||
self.db.set("RandomReact", "chats", chats) | ||
return await utils.answer( | ||
message, "👎 <b>Автоматическое выставление реакций отключено</b>") | ||
|
||
@loader.on(filters.outgoing & filters.group) | ||
async def watcher(self, app: Client, message: types.Message): | ||
"""Ставит реакции""" | ||
chat = message.chat | ||
|
||
chats = self.db.get("RandomReact", "chats", {}) | ||
if not (current_chat := chats.get(str(chat.id))): | ||
return | ||
|
||
chance = current_chat["chance"] | ||
if random.randint(0, 100) >= chance: | ||
return | ||
|
||
reactions = current_chat["reactions"] | ||
if not reactions: | ||
return | ||
|
||
try: | ||
await app.send_reaction( | ||
chat.id, message.message_id, | ||
random.choice(reactions) | ||
) | ||
except errors.RPCError as error: | ||
logging.exception(error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Sh1t-UB (telegram userbot by sh1tn3t) | ||
# Copyright (C) 2021-2022 Sh1tN3t | ||
|
||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import speedtest | ||
|
||
from pyrogram import Client, types | ||
from .. import loader, utils | ||
|
||
|
||
def speed_test(): | ||
tester = speedtest.Speedtest() | ||
tester.get_best_server() | ||
tester.download() | ||
tester.upload() | ||
return tester.results.dict() | ||
|
||
|
||
@loader.module(name="SpeedTest", author="sh1tn3t") | ||
class SpeedTestMod(loader.Module): | ||
"""Тест интернет-соединения""" | ||
|
||
async def speedtest_cmd(self, app: Client, message: types.Message): | ||
"""Запускает тест скорости. Использование: speedtest""" | ||
await utils.answer( | ||
message, "<b>Запускаем тест...</b>") | ||
|
||
result = speed_test() | ||
text = ( | ||
f"<b>Результаты теста:</b>\n\n" | ||
f"<b>Скачивание:</b> <code>{round(result['download'] / 2 ** 20 / 8, 2)}</code> <b>мб/с</b>\n" | ||
f"<b>Загрузка:</b> <code>{round(result['upload'] / 2 ** 20 / 8, 2)}</code> <b>мб/c</b>\n" | ||
f"<b>Задержка:</b> <code>{round(result['ping'], 2)}</code> <b>мc</b>" | ||
) | ||
return await utils.answer( | ||
message, text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Sh1t-UB (telegram userbot by sh1tn3t) | ||
# Copyright (C) 2021-2022 Sh1tN3t | ||
|
||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import random | ||
|
||
from pyrogram import Client, types | ||
from .. import loader, utils | ||
|
||
|
||
@loader.module("TagAll", "sh1tn3t") | ||
class TagAllMod(loader.Module): | ||
"""Тегает всех в чате""" | ||
|
||
async def tagall_cmd(self, app: Client, message: types.Message, args: str): | ||
"""Начинает всех тегать. Использование: tagall [текст]""" | ||
args = args or "говно залупное\n пашет." | ||
|
||
users = [ | ||
f"<a href=\"tg://user?id={member.user.id}\">\u2060</a>" | ||
async for member in message.chat.iter_members() | ||
if not (member.user.is_bot or member.user.is_deleted) | ||
] | ||
|
||
random.shuffle(users) | ||
await message.delete() | ||
|
||
for output in [ | ||
users[i: i + 5] | ||
for i in range(0, len(users), 5) | ||
]: | ||
await message.reply(args + "\u2060".join(output)) | ||
|
||
return |