This repository was archived by the owner on May 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed .ars - New Fake Report Image When a user is Blocked in Pm Permit - New Plugin spoiler.py
- Loading branch information
Showing
11 changed files
with
267 additions
and
4 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
aiofiles | ||
aiohttp | ||
aiohttp==3.6.3 | ||
bs4 | ||
cowpy | ||
dnspython | ||
|
Binary file not shown.
Binary file not shown.
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,160 @@ | ||
# Copyright (C) 2020 BY - GitHub.com/code-rgb [TG - @deleteduser420] | ||
# All rights reserved. | ||
|
||
|
||
import datetime | ||
import json | ||
import os | ||
from uuid import uuid1 | ||
|
||
from pyrogram import filters | ||
from pyrogram.errors import MessageNotModified | ||
from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup | ||
|
||
from userge import Config, Message, userge | ||
from userge.utils import mention_html | ||
|
||
CHANNEL = userge.getCLogger(__name__) | ||
PATH = "./userge/xcache/spoiler_db.json" | ||
|
||
|
||
class Spoiler_DB: | ||
def __init__(self): | ||
if not os.path.exists(PATH): | ||
d = {} | ||
json.dump(d, open(PATH, "w")) | ||
self.db = json.load(open(PATH)) | ||
|
||
def save_msg(self, rnd_id: str, msg_id: int): | ||
savetime = (datetime.datetime.now()).strftime("%Y-%m-%d %H:%M:%S") | ||
self.db[rnd_id] = {"msg_id": msg_id, "savetime": str(savetime)} | ||
self.save() | ||
|
||
def save(self): | ||
with open(PATH, "w") as outfile: | ||
json.dump(self.db, outfile, indent=4) | ||
|
||
|
||
SPOILER_DB = Spoiler_DB() | ||
|
||
|
||
@userge.on_cmd( | ||
"spoiler", | ||
about={ | ||
"header": "Share a spoiler", | ||
"usage": "{tr}spoiler [reply to media] or Text", | ||
}, | ||
) | ||
async def spoiler_alert_(message: Message): | ||
content = message.input_str | ||
reply = message.reply_to_message | ||
if reply and reply.text: | ||
content = reply.text.html | ||
content = "{}".format(content or "") | ||
if not (content or (reply and reply.media)): | ||
await message.err("No Content Found!") | ||
return | ||
rnd_hex = uuid1().hex | ||
rnd_id = f"spoiler_{rnd_hex}" | ||
SPOILER_DB.save_msg(rnd_hex, (await CHANNEL.store(reply, content))) | ||
bot_name = (await userge.bot.get_me()).username | ||
link = f"https://t.me/{bot_name}?start={rnd_id}" | ||
buttons = None | ||
text_ = "**{} Shared A Spoiler** !\n[> **Click To View** <]({})".format( | ||
mention_html(message.from_user.id, message.from_user.first_name), link | ||
) | ||
if message.client.is_bot: | ||
buttons = InlineKeyboardMarkup( | ||
[ | ||
[ | ||
InlineKeyboardButton( | ||
"Button", callback_data="getl{}".format(rnd_id) | ||
), | ||
InlineKeyboardButton( | ||
"Text Link", callback_data="nobtnspoiler{}".format(rnd_id) | ||
), | ||
], | ||
[ | ||
InlineKeyboardButton( | ||
"Via Inline", switch_inline_query=rnd_id.replace("_", " ") | ||
) | ||
], | ||
] | ||
) | ||
text_ = "<b><u>Choose How You Want to Share the Spoiler.</b></u>" | ||
await message.edit(text_, reply_markup=buttons, disable_web_page_preview=True) | ||
|
||
|
||
@userge.bot.on_message( | ||
filters.private | ||
& ( | ||
filters.regex(pattern=r"^/start spoiler_([\S]+)") | ||
| filters.regex(pattern=r"^/spoiler_([\S]+)") | ||
) | ||
) | ||
async def spoiler_get(_, message: Message): | ||
spoiler_key = message.matches[0].group(1) | ||
if not os.path.exists(PATH): | ||
await message.err("Not Found", del_in=5) | ||
view_data = SPOILER_DB.db | ||
mid = view_data.get(spoiler_key, None) | ||
if mid: | ||
return await CHANNEL.forward_stored( | ||
client=userge.bot, | ||
message_id=mid["msg_id"], | ||
user_id=message.from_user.id, | ||
chat_id=message.chat.id, | ||
reply_to_message_id=message.message_id, | ||
) | ||
await message.reply("Not Found / Expired") | ||
|
||
|
||
if userge.has_bot: | ||
|
||
@userge.bot.on_callback_query(filters.regex(pattern=r"^getl([\S]+)$")) | ||
async def get_spoiler_link(_, c_q: CallbackQuery): | ||
u_id = c_q.from_user.id | ||
if u_id != Config.OWNER_ID and u_id not in Config.SUDO_USERS: | ||
return await c_q.answer( | ||
"Given That It's A Stupid-Ass Decision, I've Elected To Ignore It.", | ||
show_alert=True, | ||
) | ||
await c_q.answer("With Buttons", show_alert=False) | ||
bot_name = (await userge.bot.get_me()).username | ||
buttons = [ | ||
[ | ||
InlineKeyboardButton( | ||
"View Spoiler", | ||
url=f"https://t.me/{bot_name}?start={c_q.matches[0].group(1)}", | ||
) | ||
] | ||
] | ||
try: | ||
await c_q.edit_message_text( | ||
"<b>Click To View The Spoiler !</b>", | ||
reply_markup=InlineKeyboardMarkup(buttons), | ||
) | ||
except MessageNotModified: | ||
pass | ||
|
||
@userge.bot.on_callback_query(filters.regex(pattern=r"^nobtnspoiler([\S]+)$")) | ||
async def get_spoiler_link(_, c_q: CallbackQuery): | ||
u_id = c_q.from_user.id | ||
u_name = c_q.from_user.first_name | ||
if u_id != Config.OWNER_ID and u_id not in Config.SUDO_USERS: | ||
return await c_q.answer( | ||
"Given That It's A Stupid-Ass Decision, I've Elected To Ignore It.", | ||
show_alert=True, | ||
) | ||
bot_name = (await userge.bot.get_me()).username | ||
await c_q.answer("Without Buttons", show_alert=False) | ||
url = f"https://t.me/{bot_name}?start={c_q.matches[0].group(1)}" | ||
try: | ||
await c_q.edit_message_text( | ||
"**{} Shared A Spoiler** !\n[> **Click To View** <]({})".format( | ||
mention_html(u_id, u_name), url | ||
), | ||
disable_web_page_preview=True, | ||
) | ||
except MessageNotModified: | ||
pass |
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 @@ | ||
from .fake_report import reported_user_image |
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,31 @@ | ||
# Copyright (C) 2020 BY - GitHub.com/code-rgb [TG - @deleteduser420] | ||
# All rights reserved. | ||
|
||
|
||
import textwrap | ||
from io import BytesIO | ||
|
||
from PIL import Image, ImageDraw, ImageFont | ||
from requests import get | ||
|
||
|
||
|
||
async def reported_user_image(u_name: str): | ||
"""reported user""" | ||
text1 = "Block " + u_name | ||
text2 = f"Do you want to block {u_name} from messaging and calling you on Telegram?" | ||
in_memory = BytesIO(get("https://telegra.ph/file/886e00818c68f53d24f92.jpg").content) | ||
photo = Image.open(in_memory) | ||
drawing = ImageDraw.Draw(photo) | ||
white = (255, 255, 255) | ||
font1 = ImageFont.truetype("resources/Roboto-Regular.ttf", 45) | ||
font2 = ImageFont.truetype("resources/Roboto-Medium.ttf", 55) | ||
drawing.text((132, 201), text1, fill=white, font=font2) | ||
x = 0 | ||
for u_text in textwrap.wrap(text2, width=38): | ||
drawing.text(xy=(132, 305 + x), text=u_text, font=font1, fill=white) | ||
x += 53 | ||
new_pic = BytesIO() | ||
photo.save(new_pic, format='JPEG') | ||
new_pic.name = "Blocked.jpg" | ||
return new_pic |
a3d1d3d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: