Skip to content

Commit

Permalink
fixes, new plugins
Browse files Browse the repository at this point in the history
- add fstat and fedinfo
  • Loading branch information
xditya committed Feb 26, 2021
1 parent bfe741a commit 066275a
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 15 deletions.
2 changes: 1 addition & 1 deletion plugins/afk.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
✘ Commands Available -
• `{i}afk <optional reason>`
afk means away from keyboard,
AFK means away from keyboard,
After u active this if Someting tag or msg u then It auto Reply Him/her,
(Note : By Reply To any media U can set media afk too).
Expand Down
7 changes: 3 additions & 4 deletions plugins/autopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"""
✘ Commands Available -
• `{i}autopic <search query>`
will change your profile pic at defined intervals.
search query required.
• `{i}autopic <topic>`
Will change your profile pic at defined intervals with pics related to the given topic.
"""
import asyncio
Expand Down Expand Up @@ -44,7 +43,7 @@ async def autopic(e):
animepp(page["href"])
file = await ultroid_bot.upload_file("autopic.jpg")
await ultroid_bot(functions.photos.UploadProfilePhotoRequest(file))
os.system("rm -rf autopic.jpg")
os.remove("autopic.jpg")
await asyncio.sleep(1100)


Expand Down
64 changes: 63 additions & 1 deletion plugins/superfban.py → plugins/fedutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@
Un-FBan the person across all feds in which you are admin.
Specify FBan Group and Feds to exclude in the assistant.
• `{i}fstat <username/id/reply to user>`
Collect fed stat of the person in Rose.
• `{i}fedinfo <(fedid)>`
Collect federation info of the given fed id, or of the fed you own, from Rose.
"""

import asyncio
import os

from telethon.errors.rpcerrorlist import YouBlockedUserError
from . import *

bot = "@MissRose_bot"

@ultroid_cmd(pattern="superfban ?(.*)")
async def _(event):
Expand Down Expand Up @@ -324,5 +331,60 @@ async def _(event):
f"SuperUnFBan Completed.\nTotal Feds - {len(fedlist)}.\nExcluded - {exCount}.\n Affected {len(fedList) - exCount} feds.\n#TB"
)

@ultroid_cmd(pattern="fstat ?(.*)")
async def _(event):
ok = await event.edit("`Checking...`")
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
sysarg = str(previous_message.sender_id)
user = f"[user](tg://user?id={sysarg})"
if event.pattern_match.group(1):
sysarg += f" {event.pattern_match.group(1)}"
else:
sysarg = event.pattern_match.group(1)
user = sysarg
if sysarg == "":
await ok.edit(
"`Give me someones id, or reply to somones message to check his/her fedstat.`"
)
return
else:
async with ultroid.conversation(bot) as conv:
try:
await conv.send_message("/start")
await conv.get_response()
await conv.send_message("/fedstat " + sysarg)
audio = await conv.get_response()
if "Looks like" in audio.text:
await audio.click(0)
await asyncio.sleep(2)
audio = await conv.get_response()
await ultroid.send_file(
event.chat_id,
audio,
caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
link_preview=False
)
else:
await ultroid.send_message(event.chat_id, audio.text)
await ultroid.send_read_acknowledge(bot)
await event.delete()
except YouBlockedUserError:
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")

@ultroid_cmd(pattern="fedinfo ?(.*)")
async def _(event):
ok = await event.edit("`Extracting information...`")
sysarg = event.pattern_match.group(1)
async with ultroid.conversation(bot) as conv:
try:
await conv.send_message("/start")
await conv.get_response()
await conv.send_message("/fedinfo " + sysarg)
audio = await conv.get_response()
await ultroid.send_read_acknowledge(bot)
await ok.edit(audio.text + "\n\nFedInfo Excracted by Ultroid")
except YouBlockedUserError:
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")

HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
14 changes: 6 additions & 8 deletions plugins/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@
• `{i}bots`
Shows the number of bots in the current chat with their perma-link.
• `{i}hl`
{i}hl <link> hyperlinks the message by editing the message with a blank text.
• `{i}hl <a link>`
Embeds the link with a whitespace as message.
• `{i}id`
Reply a Sticker to Get Its Id
Reply a User to Get His Id
Without Replying You Will Get the Chat's Id
• `{i}sg`
Reply The User to Get His Name History
• `{i}sg <reply to a user>`
Get His Name History of the replied user.
• `{i}tr <dest lang code> <input>`
Reply to a message with `{i}tr <lang code>`
Use `{i}tr <dest lang code> <input>`
To get translated message.
• `{i}tr <dest lang code> <(reply to) a message>`
Get translated message.
"""

import asyncio
Expand Down
2 changes: 1 addition & 1 deletion plugins/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async def stats(
pattern="paste( (.*)|$)",
)
async def _(event):
xx = await eor(event, "`...`")
xx = await eor(event, "` 《 Pasteing to nekobin...`")
input_str = "".join(event.text.split(maxsplit=1)[1:])
if input_str:
message = input_str
Expand Down

0 comments on commit 066275a

Please sign in to comment.