Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update waifu.py (Sourcery refactored) #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions waifu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
API_HASH = str(os.environ.get("API_HASH"))
STRING_SESSION = str(os.environ.get("STRING_SESSION"))
DELAY = int(os.environ.get("DELAY"))
BOT_LIST = int(x for x in os.environ.get("BOT_LIST").split())
BOT_LIST = int(iter(os.environ.get("BOT_LIST").split()))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 24-24 refactored with the following changes:

else:
from config import config

Expand Down Expand Up @@ -84,22 +84,23 @@ def get_data(img):

@waifu.add_handler(
MessageHandler(
filters.user(BOT_LIST), filters.group & ~filters.edited & ~filters.forwarded
filters.user(BOT_LIST), filters.group & ~filters.forwarded
)
)
async def autoprotecc(_, message):
if message.photo:
if "add" in message.caption.lower():
img = await message.download()
fetchUrl = await get_data(img)
match = await ParseSauce(fetchUrl + "&preferences?hl=en&fg=1#languages")
guess = match["best_guess"]
if not guess:
return await message.reply_text("Failed to protecc this waifu.")
guess = guess.replace("Results for", "")
await time.sleep(DELAY)
kek = await message.reply_text(f"/protecc {guess}")
await kek.delete()
if not message.photo:
return
if "add" in message.caption.lower():
img = await message.download()
fetchUrl = await get_data(img)
match = await ParseSauce(f"{fetchUrl}&preferences?hl=en&fg=1#languages")
guess = match["best_guess"]
if not guess:
return await message.reply_text("Failed to protecc this waifu.")
guess = guess.replace("Results for", "")
await time.sleep(DELAY)
kek = await message.reply_text(f"/protecc {guess}")
await kek.delete()
Comment on lines -91 to +103
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function autoprotecc refactored with the following changes:



waifu.start()