Skip to content

Commit

Permalink
Ultroid v0.3 Updates (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: Aditya <[email protected]>
Co-authored-by: Kaif <[email protected]>
Co-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Danish <[email protected]>
  • Loading branch information
5 people authored Dec 31, 2021
1 parent 352afe3 commit 180f64d
Show file tree
Hide file tree
Showing 48 changed files with 555 additions and 349 deletions.
2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@


from plugins import *

bot = ultroid_bot
31 changes: 31 additions & 0 deletions activitygen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

"""
✘ Commands Available -
• `{i}bored`
Get some activity to do when you get bored
"""

from . import async_searcher, ultroid_cmd


@ultroid_cmd(pattern="bored$")
async def bored_cmd(event):
msg = await event.eor("`Generating an Activity for You!`")
content = await async_searcher(
"https://www.boredapi.com/api/activity", re_json=True
)
m = f"**Activity:** `{content['activity']}`"
if content.get("link"):
m += f"**Read More:** {content['link']}"
if content.get("participants"):
m += f"\n**Participants Required:** `{content['participants']}`"
if content.get("price"):
m += f"\n**Price:** `{content['price']}`"
await msg.edit(m)
15 changes: 8 additions & 7 deletions addons.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
fonttools
covid
emoji
fonttools
gtts
jikanpy
lyrics_extractor==3.0.1
pokedex.py
pyshorteners
pyfiglet
pyjokes
speechrecognition
quotefancy
wikipedia
textblob
lyrics_extractor==3.0.1
shazamio
speechrecognition
speedtest-cli
emoji
textblob
wikipedia
4 changes: 1 addition & 3 deletions animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@

import asyncio

from . import HELP


@ultroid_cmd(pattern="kill$")
async def _(event):
animation_interval = 0.7
animation_ttl = range(0, 12)
a = await eor(event, "`ready to die dude.....`")
a = await event.eor("`ready to die dude.....`")
animation_chars = [
"Fiiiiire",
"( ・ิω・ิ)︻デ═一-->",
Expand Down
45 changes: 45 additions & 0 deletions anime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Ultroid - UserBot
# Copyright (C) 2021-2022 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

"""
✘ Commands Available -
• `{i}character <character name>`
Fetch anime character details.
"""

import jikanpy

from . import *


@ultroid_cmd(pattern="character( (.*)|$)")
async def anime_char_search(event):
xx = await event.eor(get_string("com_1"))
char_name = event.pattern_match.group(1)
if not char_name:
await eod(xx, "`Enter the name of a character too please!`", time=5)
jikan = jikanpy.jikan.Jikan()
try:
s = jikan.search("character", char_name)
except jikanpy.exceptions.APIException:
return await eod(xx, "`Couldn't find character!`", time=5)
a = s["results"][0]["mal_id"]
char_json = jikan.character(a)
pic = char_json["image_url"]
msg = f"**[{char_json['name']}]({char_json['url']})**"
if char_json["name_kanji"] != "Japanese":
msg += f" [{char_json['name_kanji']}]\n"
else:
msg += "\n"
if char_json["nicknames"]:
nicknames_string = ", ".join(char_json["nicknames"])
msg += f"\n**Nicknames** : `{nicknames_string}`\n"
about = char_json["about"].split("\n", 1)[0].strip().replace("\n", "")
msg += f"\n**About**: __{about}__"
await event.reply(msg, file=pic, force_document=False)
await xx.delete()
2 changes: 1 addition & 1 deletion animechan.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@ultroid_cmd(pattern="aniquote")
async def _(ult):
u = await eor(ult, "...")
u = await ult.eor("...")
try:
resp = requests.get("https://animechan.vercel.app/api/random").json()
results = f"**{resp['quote']}**\n"
Expand Down
5 changes: 2 additions & 3 deletions animedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
To get manga info
"""

from telethon.errors import ChatSendInlineForbiddenError

from . import *

INLOCK = "`Seems like inline messages aren't allowed here`"


@ultroid_cmd(
pattern="manga ?(.*)",
pattern="manga( (.*)|$)",
)
async def manga(ult):
msg = await eor(ult, "`Searching ...`")
msg = await ult.eor("`Searching ...`")
keyword = ult.pattern_match.group(1)
if keyword is None:
return await msg.edit("`Provide a Keyword to search`")
Expand Down
4 changes: 2 additions & 2 deletions astronomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ async def aposj(e):
img = None
expla = m.find_all("p")[2].text.replace("\n", " ")
expla = expla.split(" ")[0]
if len(expla) > 3000:
expla = expla[:3000] + "..."
if len(expla) > 900:
expla = expla[:900] + "..."
expla = "__" + expla + "__"
await e.reply(expla, file=img)
if e.out:
Expand Down
12 changes: 6 additions & 6 deletions asupan.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@
from . import *


@ultroid_cmd(pattern="asupan ?(.*)")
@ultroid_cmd(pattern="asupan( (.*)|$)")
async def _(event):
try:
response = requests.get("https://api-tede.herokuapp.com/api/asupan/ptl").json()
await event.client.send_file(event.chat_id, response["url"])
await event.delete()
except Exception:
await eor(event, "`Something went wrong LOL...`")
await event.eor("`Something went wrong LOL...`")


@ultroid_cmd(pattern="wibu ?(.*)")
@ultroid_cmd(pattern="wibu( (.*)|$)")
async def _(event):
try:
response = requests.get("https://api-tede.herokuapp.com/api/asupan/wibu").json()
await event.client.send_file(event.chat_id, response["url"])
await event.delete()
except Exception:
await eor(event, "`Something went wrong LOL...`")
await event.eor("`Something went wrong LOL...`")


@ultroid_cmd(pattern="chika ?(.*)")
@ultroid_cmd(pattern="chika( (.*)|$)")
async def _(event):
try:
response = requests.get("https://api-tede.herokuapp.com/api/chika").json()
await event.client.send_file(event.chat_id, response["url"])
await event.delete()
except Exception:
await eor(event, "`Something went wrong LOL...`")
await event.eor("`Something went wrong LOL...`")
4 changes: 2 additions & 2 deletions autoprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def autoname_(event):
match = event.pattern_match.group(1)
if match == "stop":
udB.delete("AUTONAME")
await eor(event, "`AUTONAME has been Stopped !`")
await event.eor("`AUTONAME has been Stopped !`")
return
udB.set("AUTONAME", "True")
await eod(event, "`Started AUTONAME`")
Expand All @@ -55,7 +55,7 @@ async def autoname_(event):
match = event.pattern_match.group(1)
if match == "stop":
udB.delete("AUTOBIO")
await eor(event, "`AUTOBIO has been Stopped !`")
await event.eor("`AUTOBIO has been Stopped !`")
return
udB.set("AUTOBIO", "True")
await eod(event, "`Started AUTOBIO`")
Expand Down
25 changes: 12 additions & 13 deletions clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
• `{i}revert`
Revert to your original identity
"""

import html
Expand All @@ -27,33 +26,33 @@
from . import *


@ultroid_cmd(pattern="clone ?(.*)")
@ultroid_cmd(pattern="clone( (.*)|$)", fullsudo=True)
async def _(event):
eve = await eor(event, "`Processing...`")
eve = await event.eor("`Processing...`")
reply_message = await event.get_reply_message()
whoiam = await event.client(GetFullUserRequest(ultroid_bot.uid))
if whoiam.about:
if whoiam.full_user.about:
mybio = str(ultroid_bot.me.id) + "01"
udB.set(f"{mybio}", whoiam.about) # saving bio for revert
udB.set(f"{ultroid_bot.uid}02", whoiam.user.first_name)
if whoiam.user.last_name:
udB.set(f"{ultroid_bot.uid}03", whoiam.user.last_name)
udB.set(f"{mybio}", whoiam.full_user.about) # saving bio for revert
udB.set(f"{ultroid_bot.uid}02", whoiam.users[0].first_name)
if whoiam.users[0].last_name:
udB.set(f"{ultroid_bot.uid}03", whoiam.users[0].last_name)
replied_user, error_i_a = await get_full_user(event)
if replied_user is None:
await eve.edit(str(error_i_a))
return
user_id = replied_user.user.id
user_id = replied_user.users[0].id
profile_pic = await event.client.download_profile_photo(user_id)
first_name = html.escape(replied_user.user.first_name)
first_name = html.escape(replied_user.users[0].first_name)
if first_name is not None:
first_name = first_name.replace("\u2060", "")
last_name = replied_user.user.last_name
last_name = replied_user.users[0].last_name
if last_name is not None:
last_name = html.escape(last_name)
last_name = last_name.replace("\u2060", "")
if last_name is None:
last_name = ""
user_bio = replied_user.about
user_bio = replied_user.full_user.about
await event.client(UpdateProfileRequest(first_name=first_name))
await event.client(UpdateProfileRequest(last_name=last_name))
await event.client(UpdateProfileRequest(about=user_bio))
Expand Down Expand Up @@ -89,7 +88,7 @@ async def _(event):
await client(UpdateProfileRequest(about=bio))
await client(UpdateProfileRequest(first_name=name))
await client(UpdateProfileRequest(last_name=ok))
await eor(event, "Succesfully reverted to your account back !")
await event.eor("Succesfully reverted to your account back !")
udB.delete(f"{ultroid_bot.uid}01")
udB.delete(f"{ultroid_bot.uid}02")
udB.delete(f"{ultroid_bot.uid}03")
Expand Down
4 changes: 2 additions & 2 deletions covid.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def coronish(event):
try:
country = okie[1]
except IndexError:
await eor(event, "Give a country name to Search for it's Covid Cases!")
await event.eor("Give a country name to Search for it's Covid Cases!")
return
try:
cases = covid.get_status_by_country_name((country).lower())
Expand All @@ -37,4 +37,4 @@ async def coronish(event):
f"**Country:** **{country.capitalize()}**\n**Active:** {act}\n**Confirmed:** {conf}\n**Recovered:** {rec}\n**Deceased:** {dec}",
)
except ValueError:
await eor(event, f"It seems that Country {country} is invalid!")
await event.eor(f"It seems that Country {country} is invalid!")
4 changes: 2 additions & 2 deletions devianart.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Ultroid - UserBot
# Copyright (C) 2021 TeamUltroid
# Copyright (C) 2021-2022 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
Expand All @@ -21,7 +21,7 @@
from . import *


@ultroid_cmd(pattern="devian ?(.*)")
@ultroid_cmd(pattern="devian( (.*)|$)")
async def downakd(e):
match = e.pattern_match.group(1)
if not match:
Expand Down
4 changes: 2 additions & 2 deletions encode_decode.py → encodedecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from . import *


@ultroid_cmd(pattern="encode ?(.*)")
@ultroid_cmd(pattern="encode( (.*)|$)")
async def encod(e):
match = e.pattern_match.group(1)
if not match and e.is_reply:
Expand All @@ -35,7 +35,7 @@ async def encod(e):
await eor(e, f"**=>> Encoded Text :** `{match}`\n\n**=>> OUTPUT :**\n`{atc}`")


@ultroid_cmd(pattern="decode ?(.*)")
@ultroid_cmd(pattern="decode( (.*)|$)")
async def encod(e):
match = e.pattern_match.group(1)
if not match and e.is_reply:
Expand Down
8 changes: 4 additions & 4 deletions figlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
}


@ultroid_cmd(pattern="figlet ?(.*)")
@ultroid_cmd(pattern="figlet( (.*)|$)")
async def figlet(event):
input_str = event.pattern_match.group(1)
if "|" in input_str:
Expand All @@ -470,15 +470,15 @@ async def figlet(event):
cmd = None
text = input_str
else:
await eor(event, "Please add some text to figlet")
await event.eor("Please add some text to figlet")
return
if cmd is not None:
try:
font = CMD_SET[cmd]
except KeyError:
await eor(event, "Invalid selected font.")
await event.eor("Invalid selected font.")
return
result = pyfiglet.figlet_format(text, font=font)
else:
result = pyfiglet.figlet_format(text)
await eor(event, f"‌‌‎`{result}`")
await event.eor(f"‌‌‎`{result}`")
4 changes: 2 additions & 2 deletions findsong.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
@ultroid_cmd(pattern="findsong$")
async def _(event):
if not event.reply_to_msg_id:
return await eor(event, "Reply to an audio message.")
return await event.eor("Reply to an audio message.")
reply_message = await event.get_reply_message()
chat = "@auddbot"
snku = await eor(event, "Identifying the song")
snku = await event.eor("Identifying the song")
async with event.client.conversation(chat) as conv:
try:
await conv.send_message("/start")
Expand Down
2 changes: 1 addition & 1 deletion flaticon.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from . import *


@ultroid_cmd(pattern="icon ?(.*)")
@ultroid_cmd(pattern="icon( (.*)|$)")
async def www(e):
a = e.pattern_match.group(1)
if not a:
Expand Down
Loading

0 comments on commit 180f64d

Please sign in to comment.