From 83ce616dabafca51dfcd999262111976e95c02c6 Mon Sep 17 00:00:00 2001 From: 1Danish-00 Date: Mon, 11 Oct 2021 23:45:55 +0530 Subject: [PATCH] Ultroid v0.2.1 [Fixes] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Devesh Pal Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: M̲αραт --- .../pull_request_template.md | 12 ++++++++++++ .github/workflows/greetings.yml | 16 ---------------- assistant/callbackstuffs.py | 16 ++++++++++++++++ assistant/start.py | 6 +++--- plugins/__init__.py | 1 + plugins/_inline.py | 4 ++-- plugins/button.py | 2 +- plugins/chat_bot.py | 2 +- plugins/compressor.py | 2 +- plugins/converter.py | 19 ++----------------- plugins/pmpermit.py | 8 ++++---- requirements.txt | 2 +- resources/startup/optional-requirements.txt | 1 + 13 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md delete mode 100644 .github/workflows/greetings.yml diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..dc42a28 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,12 @@ +# Title + +### Detailed Description [Optional] : +detailed_description_here + +### Issue Number [Optional] : +Issue Number here if your pull request close any issue or is linked to. + +---- +### What defines you? +- [ ] Hacktoberfest Participant. +- [ ] Contributor diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index a917e2c..0000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Greetings - -on: [pull_request, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thanks for Opening This Issue, we will look into it soon!' - pr-message: 'Thanks for Your Contribution. It will be reviewed soon, Useless Prs are Closed Immediately' diff --git a/assistant/callbackstuffs.py b/assistant/callbackstuffs.py index 970d338..9dacb43 100644 --- a/assistant/callbackstuffs.py +++ b/assistant/callbackstuffs.py @@ -1125,6 +1125,7 @@ async def chbot(event): [Button.inline("Cʜᴀᴛ Bᴏᴛ Oғғ", data="ofchbot")], [Button.inline("Bᴏᴛ Wᴇʟᴄᴏᴍᴇ", data="bwel")], [Button.inline("Bᴏᴛ Wᴇʟᴄᴏᴍᴇ Mᴇᴅɪᴀ", data="botmew")], + [Button.inline("Bᴏᴛ Iɴғᴏ Tᴇxᴛ", data="botinfe")], [Button.inline("Fᴏʀᴄᴇ Sᴜʙsᴄʀɪʙᴇ", data="pmfs")], [Button.inline("« Bᴀᴄᴋ", data="setter")], ], @@ -1132,6 +1133,21 @@ async def chbot(event): ) +@callback("botinfe", owner=True) +async def hhh(e): + async with e.client.conversation(e.chat_id) as conv: + await conv.send_message( + "Send message to set to Display, when user Press Info button in Bot Welcome!\n\nsend `False` to completely remove that button.." + ) + msg = await conv.get_response() + if msg.media or msg.text.startswith("/"): + return await conv.send_message( + "Terminated!", buttons=get_back_button("chatbot") + ) + udB.set("BOT_INFO_START", msg.text) + await conv.send_message("Done!", buttons=get_back_button("chatbot")) + + @callback("pmfs", owner=True) async def heheh(event): Ll = [] diff --git a/assistant/start.py b/assistant/start.py index 0c9405a..cf43ef0 100644 --- a/assistant/start.py +++ b/assistant/start.py @@ -9,6 +9,7 @@ from datetime import datetime from pytz import timezone as tz from pyUltroid.dB.asst_fns import * +from pyUltroid.dB.sudos import is_fullsudo from pyUltroid.functions.helper import inline_mention from pyUltroid.misc import owner_and_sudos from telethon import Button, events @@ -86,7 +87,7 @@ async def ultroid(event): await event.client.send_message( int(udB["LOG_CHANNEL"]), msg, buttons=buttons ) - if str(event.sender_id) not in owner_and_sudos(): + if (event.sender_id != OWNER_ID) and not is_fullsudo(event.sender_id): ok = "" u = await event.client.get_entity(event.chat_id) if not udB.get("STARTMSG"): @@ -153,8 +154,7 @@ async def bdcast(event): await conv.send_message( "Enter your broadcast message.\nUse /cancel to stop the broadcast.", ) - response = conv.wait_event(events.NewMessage(chats=OWNER_ID)) - response = await response + response = await conv.get_response() if response.message == "/cancel": return await conv.send_message("Cancelled!!") success = 0 diff --git a/plugins/__init__.py b/plugins/__init__.py index d6ba3b8..86aca2a 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -26,6 +26,7 @@ from telethon.tl import functions, types from strings import get_string Redis = udB.get +client = bot = ultroid_bot OWNER_NAME = ultroid_bot.me.first_name OWNER_ID = ultroid_bot.me.id diff --git a/plugins/_inline.py b/plugins/_inline.py index 0c10c3c..b40a5ca 100644 --- a/plugins/_inline.py +++ b/plugins/_inline.py @@ -435,7 +435,7 @@ async def on_plug_in_callback_query_handler(event): ) buttons.append( [ - Button.inline("« Bᴀᴄᴋ", data="buck"), + Button.inline("« Bᴀᴄᴋ", data="back"), ] ) try: @@ -622,7 +622,7 @@ async def ibuild(e): txt = ok.get("msg") or None pic = ok.get("media") or None btn = ok.get("button") or None - if not (pic and txt): + if not (pic or txt): txt = "Hey!" if pic: try: diff --git a/plugins/button.py b/plugins/button.py index c96b8a0..27650c7 100644 --- a/plugins/button.py +++ b/plugins/button.py @@ -25,7 +25,7 @@ from ._inline import something @ultroid_cmd(pattern="button") async def butt(event): - media, text = None, None + media, wut, text = None, None, None if event.reply_to: wt = await event.get_reply_message() if wt.text: diff --git a/plugins/chat_bot.py b/plugins/chat_bot.py index fdac06d..85b783b 100644 --- a/plugins/chat_bot.py +++ b/plugins/chat_bot.py @@ -35,7 +35,7 @@ async def im_lonely_chat_with_me(event): message = event.text.split(" ", 1)[1] except IndexError: return await eod(event, get_string("tban_1"), time=10) - reply_ = get_chatbot_reply(event, message=message) + reply_ = await get_chatbot_reply(message=message) await eor(event, reply_) diff --git a/plugins/compressor.py b/plugins/compressor.py index 6fa5b04..85a3bab 100644 --- a/plugins/compressor.py +++ b/plugins/compressor.py @@ -85,7 +85,7 @@ async def _(e): f'mediainfo --fullscan """{file.name}""" | grep "Frame count"' ) total_frames = x.split(":")[1].split("\n")[0] - progress = "progress.txt" + progress = f"progress-{c_time}.txt" with open(progress, "w") as fk: pass proce = await asyncio.create_subprocess_shell( diff --git a/plugins/converter.py b/plugins/converter.py index 8845d1f..499161e 100644 --- a/plugins/converter.py +++ b/plugins/converter.py @@ -35,19 +35,8 @@ except ImportError: from PIL import Image from telegraph import upload_file as uf -from telethon.tl.types import MessageMediaPhoto as photu -from . import ( - bash, - downloader, - eod, - eor, - get_paste, - get_string, - udB, - ultroid_cmd, - uploader, -) +from . import bash, downloader, eor, get_paste, get_string, udB, ultroid_cmd, uploader opn = [] @@ -57,11 +46,7 @@ opn = [] ) async def _(e): r = await e.get_reply_message() - if not (r or r.file): - return await eod(e, get_string("cvt_4")) - if not r.file.media.thumbs: - return await eod(e, get_string("cvt_5")) - if isinstance(r.media, photu): + if r.photo: dl = await r.download_media() elif r.document and r.document.thumbs: dl = await r.download_media(thumb=-1) diff --git a/plugins/pmpermit.py b/plugins/pmpermit.py index de89f2e..1110597 100644 --- a/plugins/pmpermit.py +++ b/plugins/pmpermit.py @@ -213,15 +213,15 @@ if sett == "True": ), ) async def permitpm(event): - t_in = Redis("INLINE_PM") - inline_pm = t_in == "True" + inline_pm = False + if Redis("INLINE_PM") and Redis("INLINE_PM") == "True": + inline_pm = not inline_pm user = await event.get_sender() if user.bot or user.is_self or user.verified: return if user.id in DEVLIST: return - apprv = is_approved(user.id) - if not apprv and event.text != UND: + if not is_approved(user.id) and event.text != UND: if Redis("MOVE_ARCHIVE") == "True": try: await ultroid_bot.edit_folder(user.id, folder=1) diff --git a/requirements.txt b/requirements.txt index 01100e1..b6faae1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Important Requirements here. https://github.com/New-dev0/Telethon/archive/Tarzan.zip -py-Ultroid==2021.10.10 +py-Ultroid==2021.10.11.1 pytgcalls==3.0.0.dev19 diff --git a/resources/startup/optional-requirements.txt b/resources/startup/optional-requirements.txt index 7d8f28b..a826054 100644 --- a/resources/startup/optional-requirements.txt +++ b/resources/startup/optional-requirements.txt @@ -5,6 +5,7 @@ aiohttp==3.7.4.post0 akinator.py apscheduler bs4 +cairosvg enhancer==0.1.8 gdown gingerit