├── .gitignore
├── LICENSE
├── README.md
├── __init__.py
├── activitygen.py
├── addons.txt
├── animations.py
├── anime.py
├── animechan.py
├── animedb.py
├── astronomy.py
├── autocorrect.py
├── autoprofile.py
├── brainfuck.py
├── clone.py
├── covid.py
├── encodedecode.py
├── fastly.py
├── figlet.py
├── findsong.py
├── flaticon.py
├── fontsnew.py
├── fun.py
├── hack.py
├── howto.py
├── imdb.py
├── inline
├── __init__.py
├── ghfeeds.py
├── imdb.py
├── koo.py
├── npmsearch.py
├── omgubuntu.py
├── pypi.py
├── winget.py
└── xdasearch.py
├── inlinefun.py
├── limited.py
├── memify.py
├── morsecode.py
├── ncode.py
├── ocr.py
├── pokedex.py
├── quote.py
├── quotefancy.py
├── random.py
├── searchmsgs.py
├── song.py
├── spam.py
├── speechtool.py
├── spellcheck.py
├── stickerspam.py
├── sticklet.py
├── test.py
├── totalmsgs.py
├── truthdare.py
├── typing.py
├── waifu.py
├── whichsong.py
├── wikipedia.py
└── wreplace.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode/*
2 | __pycache__
3 | ignore*
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #

2 |
3 |
4 | # UltroidAddons
5 | Plugins repository for [@TheUltroid](https://github.com/TeamUltroid/Ultroid).
6 |
7 |
8 | # Contributing
9 | If you want to contribute to this repository (adding your plugins/porting from other bots), use the format given below and create a pull request.
10 | ⚠️ First check whether the stuff you push works. Also, if the pull request doesn't follow the below format, it will be closed without prior notice.
11 |
12 | ```python
13 | # Credits @username (creator of plugin and who ported)
14 |
15 | # Ported from (if ported else skip)
16 |
17 | # Ported for Ultroid < https://github.com/TeamUltroid/Ultroid >
18 | ```
19 |
20 | Kindly do not **steal** others works without credits.
21 |
22 | # Example Plugin
23 | Required Import are Automatically Done.
24 |
25 | This Example Works Everywhere. (e.g. Groups, Personal Chats ...)
26 | ```python
27 | @ultroid_cmd(pattern="hoi")
28 | async def hello_world_example(event):
29 | # As telethon is an asyncio based lib, you will have to use `async`/`await` Syntax.
30 | await event.reply("Hello **World**.")
31 | ```
32 |
33 | This Example Works Only In Groups.
34 | ```python
35 | @ultroid_cmd(pattern="hoi", groups_only=True,)
36 | async def hello_world_example(event):
37 | await event.reply("Hello **World**.")
38 | ```
39 |
40 | If Your plugin need any additional requirements, it can be added to addons.txt
41 |
42 |
43 |
44 | > For More Information See [The Pypi Page](https://pypi.org/project/py-Ultroid).
45 |
46 | > Made with 💕 by [@TeamUltroid](https://t.me/TeamUltroid).
47 |
--------------------------------------------------------------------------------
/__init__.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 |
9 | from plugins import *
10 |
11 | bot = ultroid_bot
12 |
--------------------------------------------------------------------------------
/activitygen.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}bored`
12 | Get some activity to do when you get bored
13 | """
14 |
15 | from . import async_searcher, ultroid_cmd
16 |
17 |
18 | @ultroid_cmd(pattern="bored$")
19 | async def bored_cmd(event):
20 | msg = await event.eor("`Generating an Activity for You!`")
21 | content = await async_searcher(
22 | "https://bored-api.appbrewery.com/random", re_json=True
23 | )
24 | m = f"**Activity:** `{content['activity']}`"
25 | if content.get("link"):
26 | m += f"\n**Read More:** {content['link']}"
27 | if content.get("participants"):
28 | m += f"\n**Participants Required:** `{content['participants']}`"
29 | if content.get("price"):
30 | m += f"\n**Price:** `{content['price']}`"
31 | await msg.edit(m)
--------------------------------------------------------------------------------
/addons.txt:
--------------------------------------------------------------------------------
1 | covid
2 | emoji
3 | fonttools
4 | gtts
5 | gingerit
6 | jikanpy
7 | git+https://github.com/New-dev0/AsyncLyricsExtractor.git
8 | phlogo
9 | pokedex.py
10 | pyfiglet
11 | pygments
12 | pyjokes
13 | quotefancy
14 | shazamio
15 | speechrecognition
16 | speedtest-cli
17 | textblob
18 | wikipedia
19 |
--------------------------------------------------------------------------------
/animations.py:
--------------------------------------------------------------------------------
1 | # Ultroid Userbot
2 | # 2020 Copyright (c)
3 |
4 | # Animation Plugin
5 |
6 | """
7 | Animation Plugin
8 |
9 | ✘ Commands Available
10 |
11 | • `{i}kill`
12 | • `{i}fp`
13 |
14 | """
15 |
16 | import asyncio
17 |
18 |
19 | @ultroid_cmd(pattern="kill$")
20 | async def _(event):
21 | animation_interval = 0.7
22 | animation_ttl = range(0, 12)
23 | a = await event.eor("`ready to die dude.....`")
24 | animation_chars = [
25 | "Fiiiiire",
26 | "( ・ิω・ิ)︻デ═一-->",
27 | "---->____________",
28 | "------>__________",
29 | "-------->_________",
30 | "---------->_______",
31 | "------------>_____",
32 | "-------------->____",
33 | "------------------>",
34 | "------>;(^。^)ノ",
35 | "( ̄ー ̄) DEAD",
36 | """`Targeted user killed by Headshot😈.😈.😈.😈.😈.😈.😈......`
37 | `#Sad_Reacts_Offline`\n""",
38 | ]
39 | for i in animation_ttl:
40 | await asyncio.sleep(animation_interval)
41 | await a.edit(animation_chars[i % 12])
42 |
43 |
44 | @ultroid_cmd(pattern="fp$")
45 | async def a(e):
46 | await e.eor("🤦♂")
47 |
--------------------------------------------------------------------------------
/anime.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}character `
12 | Fetch anime character details.
13 | """
14 |
15 | import jikanpy
16 |
17 | from . import *
18 |
19 |
20 | @ultroid_cmd(pattern="character ?(.*)")
21 | async def anime_char_search(event):
22 | xx = await event.eor(get_string("com_1"))
23 | char_name = event.pattern_match.group(1)
24 | if not char_name:
25 | await eod(xx, "`Enter the name of a character too please!`", time=5)
26 | jikan = jikanpy.jikan.Jikan()
27 | try:
28 | s = jikan.search("character", char_name)
29 | except jikanpy.exceptions.APIException:
30 | return await eod(xx, "`Couldn't find character!`", time=5)
31 | a = s["results"][0]["mal_id"]
32 | char_json = jikan.character(a)
33 | pic = char_json["image_url"]
34 | msg = f"**[{char_json['name']}]({char_json['url']})**"
35 | if char_json["name_kanji"] != "Japanese":
36 | msg += f" [{char_json['name_kanji']}]\n"
37 | else:
38 | msg += "\n"
39 | if char_json["nicknames"]:
40 | nicknames_string = ", ".join(char_json["nicknames"])
41 | msg += f"\n**Nicknames** : `{nicknames_string}`\n"
42 | about = char_json["about"].split("\n", 1)[0].strip().replace("\n", "")
43 | msg += f"\n**About**: __{about}__"
44 | await event.reply(msg, file=pic, force_document=False)
45 | await xx.delete()
46 |
--------------------------------------------------------------------------------
/animechan.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | #
3 | # This file is a part of < https://github.com/TeamUltroid/UltroidAddons/>
4 |
5 | """
6 | Fetch Random anime quotes
7 |
8 | Command : `{i}aniquote`
9 | """
10 |
11 | from . import ultroid_cmd, async_searcher
12 |
13 |
14 | @ultroid_cmd(pattern="aniquote")
15 | async def _(ult):
16 | u = await ult.eor("...")
17 | try:
18 | resp = await async_searcher(
19 | "https://animechan.vercel.app/api/random", re_json=True
20 | )
21 | results = f"**{resp['quote']}**\n"
22 | results += f" — __{resp['character']} ({resp['anime']})__"
23 | return await u.edit(results)
24 | except Exception:
25 | await u.edit("`Something went wrong LOL ...`")
26 |
--------------------------------------------------------------------------------
/animedb.py:
--------------------------------------------------------------------------------
1 | # Made by : @Arnab431 || github.com/ArnabXD
2 | # Made For : https://github.com/TeamUltroid/UltroidAddons
3 |
4 | """
5 | Search animes and manga from anilist.co using @animedb_bot
6 |
7 | ✘ Commands Available
8 |
9 | • `{i}manga `
10 | To get manga info
11 | """
12 |
13 |
14 | from . import *
15 |
16 |
17 | @ultroid_cmd(
18 | pattern="manga ?(.*)",
19 | )
20 | async def manga(ult):
21 | msg = await ult.eor("`Searching ...`")
22 | keyword = ult.pattern_match.group(1)
23 | if keyword is None:
24 | return await msg.edit("`Provide a Keyword to search`")
25 | try:
26 | animes = await ult.client.inline_query("animedb_bot", f" {keyword}")
27 | await animes[0].click(
28 | ult.chat_id,
29 | reply_to=ult.reply_to_msg_id,
30 | silent=True if ult.is_reply else False,
31 | hide_via=True,
32 | )
33 | return await msg.delete()
34 | except Exception:
35 | return await msg.edit("`No Results Found ...`")
36 |
--------------------------------------------------------------------------------
/astronomy.py:
--------------------------------------------------------------------------------
1 | # Ultroid Userbot
2 | #
3 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
4 | # PLease read the GNU Affero General Public License in
5 | # .
6 |
7 | """
8 | ✘ Commands Available -
9 |
10 | • `{i}apod``
11 | Get Astronomy Picture of Day by NASA
12 | """
13 |
14 | from bs4 import BeautifulSoup as bs
15 |
16 | from . import ultroid_cmd, async_searcher
17 |
18 |
19 | @ultroid_cmd(pattern="apod$")
20 | async def aposj(e):
21 | link = "https://apod.nasa.gov/apod/"
22 | C = await async_searcher(link)
23 | m = bs(C, "html.parser", from_encoding="utf-8")
24 | try:
25 | try:
26 | img = m.find_all("img")[0]["src"]
27 | img = link + img
28 | except IndexError:
29 | img = None
30 | expla = m.find_all("p")[2].text.replace("\n", " ")
31 | expla = expla.split(" ")[0]
32 | if len(expla) > 900:
33 | expla = expla[:900] + "..."
34 | expla = "__" + expla + "__"
35 | await e.reply(expla, file=img)
36 | if e.out:
37 | await e.delete()
38 | except Exception as E:
39 | return await eod(e, str(E))
40 |
--------------------------------------------------------------------------------
/autocorrect.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | from . import get_help
9 |
10 | __doc__ = get_help("help_autocorrect")
11 |
12 | import string
13 |
14 | from . import HNDLR, LOGS, get_string, udB, ultroid_bot, ultroid_cmd # ignore: pylint
15 |
16 | try:
17 | from gingerit.gingerit import GingerIt
18 | except ImportError:
19 | LOGS.info("GingerIt not found")
20 | GingerIt = None
21 |
22 | from google_trans_new import google_translator
23 | from telethon import events
24 |
25 |
26 | @ultroid_cmd(pattern="autocorrect", fullsudo=True)
27 | async def acc(e):
28 | if not udB.get_key("AUTOCORRECT"):
29 | udB.set_key("AUTOCORRECT", "True")
30 | ultroid_bot.add_handler(
31 | gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
32 | )
33 | return await e.eor(get_string("act_1"), time=5)
34 | udB.del_key("AUTOCORRECT")
35 | await e.eor(get_string("act_2"), time=5)
36 |
37 |
38 | async def gramme(event):
39 | if not udB.get_key("AUTOCORRECT"):
40 | return
41 | t = event.text
42 | if t[0] == HNDLR or t[0].lower() not in string.ascii_lowercase or t.endswith(".."):
43 | return
44 | tt = google_translator().detect(t)
45 | if tt[0] != "en":
46 | return
47 | xx = GingerIt()
48 | x = xx.parse(t)
49 | res = x["result"]
50 | try:
51 | await event.edit(res)
52 | except BaseException:
53 | pass
54 |
55 |
56 | if GingerIt and udB.get_key("AUTOCORRECT"):
57 | ultroid_bot.add_handler(
58 | gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
59 | )
60 |
--------------------------------------------------------------------------------
/autoprofile.py:
--------------------------------------------------------------------------------
1 | #
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | # Ported Plugin
9 |
10 | """
11 | ✘ Commands Available -
12 |
13 | • `{i}autoname`
14 | `Starts AUTONAME`.
15 |
16 | • `{i}stopname`
17 | `Stops AUTONAME.`
18 |
19 | • `{i}autobio`
20 | `Starts AUTOBIO.`
21 |
22 | • `{i}stopbio`
23 | `Stops AUTOBIO.`
24 | """
25 |
26 | import random
27 |
28 | from telethon.tl.functions.account import UpdateProfileRequest
29 |
30 | from . import *
31 |
32 |
33 | @ultroid_cmd(pattern="(auto|stop)name$")
34 | async def autoname_(event):
35 | match = event.pattern_match.group(1)
36 | if match == "stop":
37 | udB.del_key("AUTONAME")
38 | await event.eor("`AUTONAME has been Stopped !`")
39 | return
40 | udB.set_key("AUTONAME", "True")
41 | await eod(event, "`Started AUTONAME`")
42 | while True:
43 | getn = udB.get_key("AUTONAME")
44 | if not getn:
45 | return
46 | DM = time.strftime("%d-%m-%y")
47 | HM = time.strftime("%H:%M")
48 | name = f"🕒{HM} ⚡{OWNER_NAME}⚡ {DM} 🗓️"
49 | await event.client(UpdateProfileRequest(first_name=name))
50 | await asyncio.sleep(1111)
51 |
52 |
53 | @ultroid_cmd(pattern="(auto|stop)bio$")
54 | async def autoname_(event):
55 | match = event.pattern_match.group(1)
56 | if match == "stop":
57 | udB.del_key("AUTOBIO")
58 | await event.eor("`AUTOBIO has been Stopped !`")
59 | return
60 | udB.set_key("AUTOBIO", "True")
61 | await eod(event, "`Started AUTOBIO`")
62 | BIOS = [
63 | "Busy Today !",
64 | "ULTROID USER",
65 | "Enjoying Life!",
66 | "Unique as Always!" "Sprinkling a bit of magic",
67 | "Intelligent !",
68 | ]
69 | while True:
70 | getn = udB.get_key("AUTOBIO")
71 | if not getn:
72 | return
73 | BIOMSG = random.choice(BIOS)
74 | DM = time.strftime("%d-%m-%y")
75 | HM = time.strftime("%H:%M")
76 | name = f"📅{DM} | {BIOMSG} | ⌚️{HM}"
77 | await event.client(
78 | UpdateProfileRequest(
79 | about=name,
80 | )
81 | )
82 | await asyncio.sleep(1111)
83 |
--------------------------------------------------------------------------------
/brainfuck.py:
--------------------------------------------------------------------------------
1 | # Made by : @Hackintush || github.com/ToxygenX
2 | # Made For : https://github.com/TeamUltroid/UltroidAddons
3 |
4 | """
5 | ✘ Commands Available
6 |
7 | • `{i}bf`
8 | Text to Brainfuck String Generator with text or reply.
9 |
10 | • `{i}rbf`
11 | Brainfuck Interpreter with string or reply.
12 | """
13 |
14 | from . import *
15 |
16 |
17 | def evaluate(commands):
18 | interpreter = BrainfuckInterpreter(commands)
19 | while interpreter.available():
20 | interpreter.step()
21 |
22 | return interpreter.output.read()
23 |
24 |
25 | __all__ = "BrainfuckInterpreter"
26 |
27 |
28 | class IOStream:
29 | def __init__(self, data=None):
30 | self._buffer = data or ""
31 |
32 | def __len__(self):
33 | return len(self._buffer)
34 |
35 | def read(self, length=None):
36 | if not length:
37 | data = self._buffer
38 | self._buffer = ""
39 | else:
40 | data = self._buffer[:length]
41 | self._buffer = self._buffer[length:]
42 |
43 | return data
44 |
45 | def write(self, data):
46 | self._buffer += data
47 |
48 |
49 | class IncrementalByteCellArray:
50 | def __init__(self):
51 | self.byte_cells = [0]
52 | self.data_pointer = 0
53 |
54 | def __getitem__(self, item):
55 | cell_amount = len(self.byte_cells)
56 | if item > cell_amount - 1:
57 | self.extend(item - cell_amount + 1)
58 |
59 | return self.byte_cells[item]
60 |
61 | def __setitem__(self, key: int, value: int):
62 | cell_amount = len(self.byte_cells)
63 | if key > cell_amount - 1:
64 | self.extend(key - cell_amount + 1)
65 |
66 | self.byte_cells[key] = value
67 |
68 | def __len__(self):
69 | return len(self.byte_cells)
70 |
71 | def __repr__(self):
72 | return self.byte_cells.__repr__()
73 |
74 | def extend(self, size: int):
75 | self.byte_cells += [0] * size
76 |
77 | def increment(self):
78 | new_val = (self.get() + 1) % 256
79 | self.set(new_val)
80 |
81 | def decrement(self):
82 | new_val = self.get() - 1
83 | if new_val < 0:
84 | new_val = 255
85 |
86 | self.set(new_val)
87 |
88 | def set(self, value: int):
89 | self.__setitem__(self.data_pointer, value)
90 |
91 | def get(self):
92 | return self.__getitem__(self.data_pointer)
93 |
94 |
95 | class BrainfuckInterpreter:
96 | def __init__(self, commands: str):
97 | self._commands = commands
98 |
99 | self.input = IOStream()
100 | self.output = IOStream()
101 |
102 | self.instruction_pointer = 0
103 | self.cells = IncrementalByteCellArray()
104 |
105 | self._opening_bracket_indexes = []
106 |
107 | def _look_forward(self):
108 | remaining_commands = self._commands[self.instruction_pointer :]
109 | loop_counter = 0
110 | index = self.instruction_pointer
111 |
112 | for command in remaining_commands:
113 | if command == "[":
114 | loop_counter += 1
115 | elif command == "]":
116 | loop_counter -= 1
117 |
118 | if loop_counter == 0:
119 | return index
120 |
121 | index += 1
122 |
123 | def _interpret(self):
124 | instruction = self._commands[self.instruction_pointer]
125 |
126 | if instruction == ">":
127 | self.cells.data_pointer += 1
128 | elif instruction == "<":
129 | self.cells.data_pointer -= 1
130 | elif instruction == "+":
131 | self.cells.increment()
132 | elif instruction == "-":
133 | self.cells.decrement()
134 | elif instruction == ".":
135 | self.output.write(chr(self.cells.get()))
136 | elif instruction == ",":
137 | self.cells.set(self.input.read(1))
138 | elif instruction == "[":
139 | if self.cells.get() == 0:
140 | loop_end = self._look_forward()
141 | self.instruction_pointer = loop_end
142 | else:
143 | self._opening_bracket_indexes.append(self.instruction_pointer)
144 | elif instruction == "]":
145 | if self.cells.get() != 0:
146 | opening_bracket_index = self._opening_bracket_indexes.pop(-1)
147 |
148 | self.instruction_pointer = opening_bracket_index - 1
149 | else:
150 | self._opening_bracket_indexes.pop(-1)
151 |
152 | def step(self) -> None:
153 | self._interpret()
154 | self.instruction_pointer += 1
155 |
156 | def available(self) -> bool:
157 | return not self.instruction_pointer >= len(self._commands)
158 |
159 | def command(self):
160 | return self._commands[self.instruction_pointer]
161 |
162 |
163 | def bf(text):
164 | items = []
165 | for c in text:
166 | items.append(
167 | "[-]>[-]<"
168 | + ("+" * (ord(c) // 10))
169 | + "[>++++++++++<-]>"
170 | + ("+" * (ord(c) % 10))
171 | + ".<"
172 | )
173 | return "".join(items)
174 |
175 |
176 | @ultroid_cmd(
177 | pattern="bf",
178 | )
179 | async def _(event):
180 | input_ = event.text[4:]
181 | if not input_:
182 | if event.reply_to_msg_id:
183 | previous_message = await event.get_reply_message()
184 | input_ = previous_message.message
185 | else:
186 | return await eod(event, "Give me some text lol", time=5)
187 | await event.eor(bf(input_))
188 |
189 |
190 | @ultroid_cmd(
191 | pattern="rbf",
192 | )
193 | async def _(event):
194 | input_ = event.text[5:]
195 | if not input_:
196 | if event.reply_to_msg_id:
197 | previous_message = await event.get_reply_message()
198 | input_ = previous_message.message
199 | else:
200 | return await eod(event, "Give me some text lol", time=5)
201 | await event.eor(f"{evaluate(input_)}")
202 |
--------------------------------------------------------------------------------
/clone.py:
--------------------------------------------------------------------------------
1 | # Ported From DarkCobra , Originally By Uniborg
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available
10 |
11 | • `{i}clone `
12 | clone the identity of user.
13 |
14 | • `{i}revert`
15 | Revert to your original identity
16 | """
17 | import html
18 | import os
19 |
20 | from telethon.tl.functions.account import UpdateProfileRequest
21 | from telethon.tl.functions.photos import DeletePhotosRequest, UploadProfilePhotoRequest
22 | from telethon.tl.functions.users import GetFullUserRequest
23 | from telethon.tl.types import MessageEntityMentionName
24 |
25 | from . import *
26 |
27 |
28 | @ultroid_cmd(pattern="clone ?(.*)", fullsudo=True)
29 | async def _(event):
30 | eve = await event.eor("Processing...")
31 | reply_message = await event.get_reply_message()
32 | whoiam = await event.client(GetFullUserRequest(ultroid_bot.uid))
33 | if whoiam.full_user.about:
34 | mybio = f"{str(ultroid_bot.me.id)}01"
35 | # saving bio for revert
36 | udB.set_key(f"{mybio}", whoiam.full_user.about)
37 | udB.set_key(f"{ultroid_bot.uid}02", whoiam.users[0].first_name)
38 | if whoiam.users[0].last_name:
39 | udB.set_key(f"{ultroid_bot.uid}03", whoiam.users[0].last_name)
40 | replied_user, error_i_a = await get_full_user(event)
41 | if replied_user is None:
42 | await eve.edit(str(error_i_a))
43 | return
44 | user_id = replied_user.users[0].id
45 | profile_pic = await event.client.download_profile_photo(user_id)
46 | first_name = html.escape(replied_user.users[0].first_name)
47 | if first_name is not None:
48 | first_name = first_name.replace("\u2060", "")
49 | last_name = replied_user.users[0].last_name
50 | if last_name is not None:
51 | last_name = html.escape(last_name)
52 | last_name = last_name.replace("\u2060", "")
53 | if last_name is None:
54 | last_name = ""
55 | user_bio = replied_user.full_user.about
56 | await event.client(UpdateProfileRequest(first_name=first_name))
57 | await event.client(UpdateProfileRequest(last_name=last_name))
58 | await event.client(UpdateProfileRequest(about=user_bio))
59 | if profile_pic:
60 | pfile = await event.client.upload_file(profile_pic)
61 | await event.client(UploadProfilePhotoRequest(file=pfile))
62 | os.remove(profile_pic)
63 | await eve.delete()
64 | await event.client.send_message(
65 | event.chat_id, f"I am {first_name} from now...", reply_to=reply_message
66 | )
67 |
68 |
69 | @ultroid_cmd(pattern="revert$")
70 | async def _(event):
71 | name = OWNER_NAME
72 | mybio = f"{str(ultroid_bot.me.id)}01"
73 | bio = chc if (chc := udB.get_key(mybio)) else "Error : Bio Lost"
74 | fname = udB.get_key(f"{ultroid_bot.uid}02")
75 | lname = udB.get_key(f"{ultroid_bot.uid}03")
76 | if fname:
77 | name = fname
78 | ok = lname if lname else ""
79 | n = 1
80 | client = event.client
81 | await client(
82 | DeletePhotosRequest(await event.client.get_profile_photos("me", limit=n))
83 | )
84 | await client(UpdateProfileRequest(about=bio))
85 | await client(UpdateProfileRequest(first_name=name))
86 | await client(UpdateProfileRequest(last_name=ok))
87 | await event.eor("Succesfully reverted to your account back !")
88 | udB.del_key(f"{ultroid_bot.uid}01")
89 | udB.del_key(f"{ultroid_bot.uid}02")
90 | udB.del_key(f"{ultroid_bot.uid}03")
91 |
92 |
93 | async def get_full_user(event):
94 | if event.reply_to_msg_id:
95 | previous_message = await event.get_reply_message()
96 | if previous_message.forward:
97 | replied_user = await event.client(
98 | GetFullUserRequest(
99 | previous_message.forward.sender_id
100 | or previous_message.forward.channel_id
101 | )
102 | )
103 | return replied_user, None
104 | replied_user = await event.client(
105 | GetFullUserRequest(previous_message.sender_id)
106 | )
107 | return replied_user, None
108 | else:
109 | input_str = None
110 | try:
111 | input_str = event.pattern_match.group(1)
112 | except IndexError as e:
113 | return None, e
114 | if event.message.entities is not None:
115 | mention_entity = event.message.entities
116 | probable_user_mention_entity = mention_entity[0]
117 | if isinstance(probable_user_mention_entity, MessageEntityMentionName):
118 | user_id = probable_user_mention_entity.user_id
119 | replied_user = await event.client(GetFullUserRequest(user_id))
120 | return replied_user, None
121 | try:
122 | user_object = await event.client.get_entity(input_str)
123 | user_id = user_object.id
124 | replied_user = await event.client(GetFullUserRequest(user_id))
125 | return replied_user, None
126 | except Exception as e:
127 | return None, e
128 | elif event.is_private:
129 | try:
130 | user_id = event.chat_id
131 | replied_user = await event.client(GetFullUserRequest(user_id))
132 | return replied_user, None
133 | except Exception as e:
134 | return None, e
135 | else:
136 | try:
137 | user_object = await event.client.get_entity(int(input_str))
138 | user_id = user_object.id
139 | replied_user = await event.client(GetFullUserRequest(user_id))
140 | return replied_user, None
141 | except Exception as e:
142 | return None, e
143 |
--------------------------------------------------------------------------------
/covid.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available
10 |
11 | • `{i}covid country name`
12 | Gets the Covid-19 Status of a given Country.
13 | """
14 |
15 | from covid import Covid
16 |
17 | from . import ultroid_cmd
18 |
19 |
20 | @ultroid_cmd(pattern="covid")
21 | async def coronish(event):
22 | covid = Covid()
23 | okie = event.text.split(maxsplit=1)
24 | try:
25 | country = okie[1]
26 | except IndexError:
27 | await event.eor("Give a country name to Search for it's Covid Cases!")
28 | return
29 | try:
30 | cases = covid.get_status_by_country_name((country).lower())
31 | act = cases["active"]
32 | conf = cases["confirmed"]
33 | dec = cases["deaths"]
34 | rec = cases["recovered"]
35 | await event.eor(
36 | f"**Country:** **{country.capitalize()}**\n**Active:** {act}\n**Confirmed:** {conf}\n**Recovered:** {rec}\n**Deceased:** {dec}",
37 | )
38 | except ValueError:
39 | await event.eor(f"It seems that Country {country} is invalid!")
40 |
--------------------------------------------------------------------------------
/encodedecode.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • {i}encode
12 | encode the text
13 |
14 | • {i}decode
15 | decode the text
16 | """
17 |
18 | import base64
19 |
20 | from . import ultroid_cmd
21 |
22 |
23 | @ultroid_cmd(pattern="encode ?(.*)")
24 | async def encod(e):
25 | match = e.pattern_match.group(1)
26 | if not match and e.is_reply:
27 | gt = await e.get_reply_message()
28 | if gt.text:
29 | match = gt.text
30 | if not (match or e.is_reply):
31 | return await e.eor("`Give me Something to Encode..`")
32 | byt = match.encode("ascii")
33 | et = base64.b64encode(byt)
34 | atc = et.decode("ascii")
35 | await e.eor(f"**=>> Encoded Text :** `{match}`\n\n**=>> OUTPUT :**\n`{atc}`")
36 |
37 |
38 | @ultroid_cmd(pattern="decode ?(.*)")
39 | async def encod(e):
40 | match = e.pattern_match.group(1)
41 | if not match and e.is_reply:
42 | gt = await e.get_reply_message()
43 | if gt.text:
44 | match = gt.text
45 | if not (match or e.is_reply):
46 | return await e.eor("`Give me Something to Decode..`")
47 | byt = match.encode("ascii")
48 | try:
49 | et = base64.b64decode(byt)
50 | atc = et.decode("ascii")
51 | await e.eor(f"**=>> Decoded Text :** `{match}`\n\n**=>> OUTPUT :**\n`{atc}`")
52 | except Exception as p:
53 | await e.eor("**ERROR :** " + str(p))
54 |
--------------------------------------------------------------------------------
/fastly.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | Fasly Bot Cheat.
10 |
11 | • `{i}fastly` - On/Off command.
12 |
13 | • Also Required : `OCR_API`. Add it using the command `.setdb OCR_API api_key`
14 | • To get the API visit 'https://ocr.space/ocrapi'
15 | The bot will try to auto reply first to the messages by @FastlyWriteBot
16 |
17 | • Add User id of fastly clone to `FASTLY_CLONES` to allow this plugin work with them.
18 | """
19 |
20 | from telegraph import upload_file
21 | from telethon import events
22 | from . import udB, LOGS, ultroid_bot, ultroid_cmd, async_searcher
23 | from os import remove
24 |
25 | base_url = "https://api.ocr.space/parse/imageurl?apikey={api}&url={tgraph}"
26 |
27 | BotList = [1806208310]
28 |
29 | if udB.get_key("FASTLY_CLONES"):
30 | for i in udB.get_key("FASTLY_CLONES").split():
31 | try:
32 | BotList.append(int(i))
33 | except TypeError:
34 | LOGS.exception(f"Invalid Value in 'FASTLY_CLONES': {i}")
35 |
36 |
37 | async def fastly_bot(event):
38 | if not udB.get_key("FASTLY"):
39 | return
40 | api = udB.get_key("OCR_API")
41 | if not (api and event.photo):
42 | return
43 | med = await event.download_media()
44 | upload = upload_file(med)
45 | link = "https://telegra.ph" + upload[0]
46 | out = await async_searcher(base_url.format(api=api, tgraph=link), re_json=True)
47 | try:
48 | txt = out["ParsedResults"][0]["ParsedText"]
49 | except (KeyError, IndexError):
50 | return
51 | txt = txt.split("By@")[0].replace("\n", "").replace("\r", "")
52 | if txt:
53 | try:
54 | await event.reply(txt)
55 | except Exception as er:
56 | LOGS.exception(er)
57 | try:
58 | remove(med)
59 | except Exception as e:
60 | LOGS.exception(e)
61 |
62 |
63 | @ultroid_cmd(pattern="fastly$")
64 | async def fastOnOff(event):
65 | xx = await event.eor("`...`")
66 | get_ = udB.get_key("FASTLY")
67 | if not get_:
68 | if not udB.get_key("OCR_API"):
69 | return await xx.edit("`OCR_API` is missing.\nAdd it before using this..")
70 | udB.set_key("FASTLY", True)
71 | ultroid_bot.add_handler(
72 | fastly_bot,
73 | events.NewMessage(incoming=True, from_users=BotList),
74 | )
75 | return await xx.edit("`Auto Fastly Response Activated`")
76 | udB.del_key("FASTLY")
77 | await xx.edit("`Fastly Stopped!`")
78 |
79 |
80 | if udB.get_key("FASTLY"):
81 | ultroid_bot.add_handler(
82 | fastly_bot,
83 | events.NewMessage(incoming=True, from_users=BotList),
84 | )
85 |
--------------------------------------------------------------------------------
/figlet.py:
--------------------------------------------------------------------------------
1 | """
2 | ✘ Commands Available
3 |
4 | • `{i}figlet `
5 | Make a text a figlet.
6 | """
7 |
8 | import pyfiglet
9 |
10 | from . import ultroid_cmd, split_list
11 |
12 | CMD_SET = {
13 | "slant": "slant",
14 | "3D": "3-d",
15 | "5line": "5lineoblique",
16 | "alpha": "alphabet",
17 | "banner": "banner3-D",
18 | "doh": "doh",
19 | "iso": "isometric1",
20 | "letters": "letters",
21 | "allig": "alligator",
22 | "dotm": "dotmatrix",
23 | "bubble": "bubble",
24 | "bulb": "bulbhead",
25 | "digi": "digital",
26 | "3x5": "3x5",
27 | "1943": "1943____",
28 | "4x4": "4x4_offr",
29 | "5x7": "5x7",
30 | "5x8": "5x8",
31 | "64f1": "64f1____",
32 | "6x10": "6x10",
33 | "6x9": "6x9",
34 | "zooloo": "a_zooloo",
35 | "acro": "acrobatic",
36 | "aveng": "advenger",
37 | "allig2": "alligator2",
38 | "aqua": "aquaplan",
39 | "arrows": "arrows",
40 | "asc": "asc_____",
41 | "ascii12": "ascii12",
42 | "ascii9": "ascii9",
43 | "ascii": "ascii___",
44 | "assalt": "assalt_m",
45 | "asslt": "asslt__m",
46 | "atc": "atc_____",
47 | "atcg": "atc_gran",
48 | "avatar": "avatar",
49 | "bm200": "b_m__200",
50 | "banner3": "banner3",
51 | "banner4": "banner4",
52 | "barb": "barbwire",
53 | "basic": "basic",
54 | "battles": "battle_s",
55 | "battlesh": "battlesh",
56 | "baz": "baz__bil",
57 | "beer": "beer_pub",
58 | "bell": "bell",
59 | "big": "big",
60 | "bigascii12": "bigascii12",
61 | "bigascii9": "bigascii9",
62 | "bigchief": "bigchief",
63 | "bigmono12": "bigmono12",
64 | "bigmono9": "bigmono9",
65 | "binary": "binary",
66 | "block": "block",
67 | "brite": "brite",
68 | "briteb": "briteb",
69 | "britebi": "britebi",
70 | "britei": "britei",
71 | "broadway": "broadway",
72 | "bubbles": "bubble__",
73 | "buble": "bubble_b",
74 | "bhead": "bulbhead",
75 | "c1": "c1______",
76 | "c2": "c2______",
77 | "cascii": "c_ascii_",
78 | "cconsen": "c_consen",
79 | "calgphy2": "calgphy2",
80 | "caligraphy": "caligraphy",
81 | "catwalk": "catwalk",
82 | "causin": "caus_in_",
83 | "char1": "char1___",
84 | "char2": "char2___",
85 | "char3": "char3___",
86 | "char4": "char4___",
87 | "charact1": "charact1",
88 | "charact2": "charact2",
89 | "charact3": "charact3",
90 | "charact4": "charact4",
91 | "charact5": "charact5",
92 | "charact6": "charact6",
93 | "characte": "characte",
94 | "charset": "charset_",
95 | "chartr": "chartr",
96 | "chartri": "chartri",
97 | "chunky": "chunky",
98 | "circle": "circle",
99 | "clb6x10": "clb6x10",
100 | "clb8x10": "clb8x10",
101 | "clb8x8": "clb8x8",
102 | "clr4x6": "clr4x6",
103 | "clr5x10": "clr5x10",
104 | "clr5x6": "clr5x6",
105 | "clr5x8": "clr5x8",
106 | "clr6x10": "clr6x10",
107 | "clr6x6": "clr6x6",
108 | "clr6x8": "clr6x8",
109 | "clr7x10": "clr7x10",
110 | "clr7x8": "clr7x8",
111 | "clr8x10": "clr8x10",
112 | "clr8x8": "clr8x8",
113 | "coilcop": "coil_cop",
114 | "coinstak": "coinstak",
115 | "colossal": "colossal",
116 | "comsen": "com_sen_",
117 | "computer": "computer",
118 | "contessa": "contessa",
119 | "contrast": "contrast",
120 | "convoy": "convoy__",
121 | "cosmic": "cosmic",
122 | "cosmike": "cosmike",
123 | "cour": "cour",
124 | "courb": "courb",
125 | "courbi": "courbi",
126 | "couri": "couri",
127 | "crawford": "crawford",
128 | "cricket": "cricket",
129 | "cursive": "cursive",
130 | "cyberlarge": "cyberlarge",
131 | "cybermedium": "cybermedium",
132 | "cybersmall": "cybersmall",
133 | "ddragon": "d_dragon",
134 | "dcsbfmo": "dcs_bfmo",
135 | "decimal": "decimal",
136 | "deepstr": "deep_str",
137 | "defleppard": "defleppard",
138 | "demo1": "demo_1__",
139 | "demo2": "demo_2__",
140 | "demom": "demo_m__",
141 | "devilish": "devilish",
142 | "diamond": "diamond",
143 | "doom": "doom",
144 | "double": "double",
145 | "drpepper": "drpepper",
146 | "druid": "druid___",
147 | "efist": "e__fist_",
148 | "ebbs1": "ebbs_1__",
149 | "ebbs2": "ebbs_2__",
150 | "eca": "eca_____",
151 | "eftichess": "eftichess",
152 | "eftifont": "eftifont",
153 | "eftipiti": "eftipiti",
154 | "eftirobot": "eftirobot",
155 | "eftitalic": "eftitalic",
156 | "eftiwall": "eftiwall",
157 | "eftiwater": "eftiwater",
158 | "emboss": "emboss",
159 | "emboss2": "emboss2",
160 | "epic": "epic",
161 | "etcrvs": "etcrvs__",
162 | "f15": "f15_____",
163 | "facesof": "faces_of",
164 | "fairmea": "fair_mea",
165 | "fairligh": "fairligh",
166 | "fantasy": "fantasy_",
167 | "fbr12": "fbr12___",
168 | "fbr1": "fbr1____",
169 | "fbr2": "fbr2____",
170 | "fbrstri": "fbr_stri",
171 | "fbrtilt": "fbr_tilt",
172 | "fender": "fender",
173 | "finalass": "finalass",
174 | "fireing": "fireing_",
175 | "flynsh": "flyn_sh",
176 | "fourtops": "fourtops",
177 | "fp1": "fp1_____",
178 | "fp2": "fp2_____",
179 | "fraktur": "fraktur",
180 | "funkydr": "funky_dr",
181 | "future": "future",
182 | "future1": "future_1",
183 | "future2": "future_2",
184 | "future3": "future_3",
185 | "future4": "future_4",
186 | "future5": "future_5",
187 | "future6": "future_6",
188 | "future7": "future_7",
189 | "future8": "future_8",
190 | "fuzzy": "fuzzy",
191 | "gauntlet": "gauntlet",
192 | "ghostbo": "ghost_bo",
193 | "goofy": "goofy",
194 | "gothic": "gothic",
195 | "gothics": "gothic__",
196 | "graceful": "graceful",
197 | "gradient": "gradient",
198 | "graffiti": "graffiti",
199 | "grandpr": "grand_pr",
200 | "greek": "greek",
201 | "greenbe": "green_be",
202 | "hades": "hades___",
203 | "heavyme": "heavy_me",
204 | "helv": "helv",
205 | "helvb": "helvb",
206 | "helvbi": "helvbi",
207 | "helvi": "helvi",
208 | "heroboti": "heroboti",
209 | "hex": "hex",
210 | "highnoo": "high_noo",
211 | "hills": "hills___",
212 | "holly": "hollywood",
213 | "homepak": "home_pak",
214 | "houseof": "house_of",
215 | "hypabal": "hypa_bal",
216 | "hyper": "hyper___",
217 | "incraw": "inc_raw_",
218 | "invita": "invita",
219 | "iso2": "isometric2",
220 | "iso3": "isometric3",
221 | "iso4": "isometric4",
222 | "italic": "italic",
223 | "italics": "italics_",
224 | "ivrit": "ivrit",
225 | "jazmine": "jazmine",
226 | "jerusalem": "jerusalem",
227 | "joust": "joust___",
228 | "ktk": "katakana",
229 | "kban": "kban",
230 | "kgamesi": "kgames_i",
231 | "kikstar": "kik_star",
232 | "krakout": "krak_out",
233 | "larry3d": "larry3d",
234 | "lazyjon": "lazy_jon",
235 | "lcd": "lcd",
236 | "lean": "lean",
237 | "letter": "letter",
238 | "letterr": "letter_",
239 | "letterw3": "letterw3",
240 | "lexible": "lexible_",
241 | "linux": "linux",
242 | "lockergnome": "lockergnome",
243 | "lower": "lower",
244 | "madnurs": "mad_nurs",
245 | "madrid": "madrid",
246 | "magicma": "magic_ma",
247 | "marquee": "marquee",
248 | "mastero": "master_o",
249 | "maxfour": "maxfour",
250 | "mayhemd": "mayhem_d",
251 | "mcg": "mcg_____",
252 | "migally": "mig_ally",
253 | "mike": "mike",
254 | "mini": "mini",
255 | "mirror": "mirror",
256 | "mnemonic": "mnemonic",
257 | "modern": "modern__",
258 | "mono12": "mono12",
259 | "mono9": "mono9",
260 | "morse": "morse",
261 | "moscow": "moscow",
262 | "mshebrew210": "mshebrew210",
263 | "nancyjf": "nancyj-fancy",
264 | "nancyju": "nancyj-underlined",
265 | "nancyj": "nancyj",
266 | "newasci": "new_asci",
267 | "nfi1": "nfi1____",
268 | "nipl": "nipples",
269 | "notieca": "notie_ca",
270 | "npn": "npn_____",
271 | "ntgreek": "ntgreek",
272 | "null": "null",
273 | "nvscript": "nvscript",
274 | "o8": "o8",
275 | "octal": "octal",
276 | "odellak": "odel_lak",
277 | "ogre": "ogre",
278 | "okbeer": "ok_beer_",
279 | "os2": "os2",
280 | "outrun": "outrun__",
281 | "pshm": "p_s_h_m_",
282 | "pskateb": "p_skateb",
283 | "pacospe": "pacos_pe",
284 | "pagga": "pagga",
285 | "panther": "panther_",
286 | "pawnins": "pawn_ins",
287 | "pawp": "pawp",
288 | "peaks": "peaks",
289 | "pebbles": "pebbles",
290 | "pepper": "pepper",
291 | "phonix": "phonix__",
292 | "platoon2": "platoon2",
293 | "platoon": "platoon_",
294 | "pod": "pod_____",
295 | "poison": "poison",
296 | "puffy": "puffy",
297 | "pyramid": "pyramid",
298 | "r2d2": "r2-d2___",
299 | "rad": "rad_____",
300 | "radphan": "rad_phan",
301 | "radical": "radical_",
302 | "rainbow": "rainbow_",
303 | "rallys2": "rally_s2",
304 | "rallysp": "rally_sp",
305 | "rampage": "rampage_",
306 | "rastan": "rastan__",
307 | "rawrecu": "raw_recu",
308 | "rci": "rci_____",
309 | "rectangles": "rectangles",
310 | "relief": "relief",
311 | "relief2": "relief2",
312 | "rev": "rev",
313 | "ripper": "ripper!_",
314 | "roadrai": "road_rai",
315 | "rockbox": "rockbox_",
316 | "rok": "rok_____",
317 | "roman": "roman",
318 | "romans": "roman___",
319 | "rot13": "rot13",
320 | "rounded": "rounded",
321 | "rowancap": "rowancap",
322 | "rozzo": "rozzo",
323 | "runic": "runic",
324 | "runyc": "runyc",
325 | "sans": "sans",
326 | "sansb": "sansb",
327 | "sansbi": "sansbi",
328 | "sansi": "sansi",
329 | "sblood": "sblood",
330 | "sbook": "sbook",
331 | "sbookb": "sbookb",
332 | "sbookbi": "sbookbi",
333 | "sbooki": "sbooki",
334 | "script": "script",
335 | "scripts": "script__",
336 | "serifcap": "serifcap",
337 | "shadow": "shadow",
338 | "shimrod": "shimrod",
339 | "short": "short",
340 | "skatero": "skate_ro",
341 | "skateord": "skateord",
342 | "skateroc": "skateroc",
343 | "sketchs": "sketch_s",
344 | "slide": "slide",
345 | "slscript": "slscript",
346 | "sm": "sm______",
347 | "small": "small",
348 | "smascii12": "smascii12",
349 | "smascii9": "smascii9",
350 | "smblock": "smblock",
351 | "smbraille": "smbraille",
352 | "smisome1": "smisome1",
353 | "smkeyboard": "smkeyboard",
354 | "smmono12": "smmono12",
355 | "smmono9": "smmono9",
356 | "smscript": "smscript",
357 | "smshadow": "smshadow",
358 | "smslant": "smslant",
359 | "smtengwar": "smtengwar",
360 | "spaceop": "space_op",
361 | "spcdemo": "spc_demo",
362 | "speed": "speed",
363 | "stacey": "stacey",
364 | "stampatello": "stampatello",
365 | "standard": "standard",
366 | "starwar": "star_war",
367 | "starwars": "starwars",
368 | "stealth": "stealth_",
369 | "stellar": "stellar",
370 | "stencil1": "stencil1",
371 | "stencil2": "stencil2",
372 | "stop": "stop",
373 | "straight": "straight",
374 | "street_s": "street_s",
375 | "subteran": "subteran",
376 | "superte": "super_te",
377 | "tofap": "t__of_ap",
378 | "tanja": "tanja",
379 | "tav1": "tav1____",
380 | "taxi": "taxi____",
381 | "tec1": "tec1____",
382 | "tec7000": "tec_7000",
383 | "tecrvs": "tecrvs__",
384 | "tengwar": "tengwar",
385 | "term": "term",
386 | "thick": "thick",
387 | "thin": "thin",
388 | "threepoint": "threepoint",
389 | "tipan": "ti_pan__",
390 | "ticks": "ticks",
391 | "ticksslant": "ticksslant",
392 | "tiles": "tiles",
393 | "times": "times",
394 | "timesofl": "timesofl",
395 | "tinkertoy": "tinker-toy",
396 | "tomahawk": "tomahawk",
397 | "tombstone": "tombstone",
398 | "top_duck": "top_duck",
399 | "trashman": "trashman",
400 | "trek": "trek",
401 | "triadst": "triad_st",
402 | "ts1": "ts1_____",
403 | "tsalagi": "tsalagi",
404 | "tsm": "tsm_____",
405 | "tsnbase": "tsn_base",
406 | "tty": "tty",
407 | "ttyb": "ttyb",
408 | "tubular": "tubular",
409 | "twincob": "twin_cob",
410 | "twopoint": "twopoint",
411 | "typeset": "type_set",
412 | "ucffan": "ucf_fan_",
413 | "ugalympi": "ugalympi",
414 | "unarmed": "unarmed_",
415 | "univers": "univers",
416 | "upper": "upper",
417 | "usa": "usa_____",
418 | "usapq": "usa_pq__",
419 | "usaflag": "usaflag",
420 | "utopia": "utopia",
421 | "utopiab": "utopiab",
422 | "utopiabi": "utopiabi",
423 | "utopiai": "utopiai",
424 | "vortron": "vortron_",
425 | "warofw": "war_of_w",
426 | "wavy": "wavy",
427 | "weird": "weird",
428 | "whimsy": "whimsy",
429 | "wideterm": "wideterm",
430 | "xbrite": "xbrite",
431 | "xbriteb": "xbriteb",
432 | "xbritebi": "xbritebi",
433 | "xbritei": "xbritei",
434 | "xchartr": "xchartr",
435 | "xchartri": "xchartri",
436 | "xcour": "xcour",
437 | "xcourb": "xcourb",
438 | "xcourbi": "xcourbi",
439 | "xcouri": "xcouri",
440 | "xhelv": "xhelv",
441 | "xhelvb": "xhelvb",
442 | "xhelvbi": "xhelvbi",
443 | "xhelvi": "xhelvi",
444 | "xsans": "xsans",
445 | "xsansb": "xsansb",
446 | "xsansbi": "xsansbi",
447 | "xsansi": "xsansi",
448 | "xsbook": "xsbook",
449 | "xsbookb": "xsbookb",
450 | "xsbookbi": "xsbookbi",
451 | "xsbooki": "xsbooki",
452 | "xtimes": "xtimes",
453 | "xtty": "xtty",
454 | "xttyb": "xttyb",
455 | "yiear": "yie-ar__",
456 | "yieark": "yie_ar_k",
457 | "zpilot": "z-pilot_",
458 | "zigzag": "zig_zag_",
459 | "zone7": "zone7___",
460 | }
461 |
462 | DataList = sorted(list(CMD_SET.keys()))
463 | Split = split_list(DataList, 42)
464 | offset = 0
465 |
466 |
467 | @ultroid_cmd(pattern="figlet( ?(.*)|$)")
468 | async def figlet(event):
469 | input_str = event.pattern_match.group(1).strip()
470 | if not input_str:
471 | return await event.eor("`Provide some text to make figlet...`")
472 | if input_str == "list":
473 | global offset
474 | if offset == len(Split):
475 | offset = 0
476 | All = Split[offset]
477 | Text = "**List of Figlet Fonts :**\n\n"
478 | while All:
479 | c = 3
480 | Nline = "•• " + " ".join([f"`{a}`" for a in All[:3]])
481 | while (c < len(All) - 1) and len(Nline) < 32:
482 | c += 1
483 | Nline += f" `{All[c]}`"
484 | Text += Nline + "\n"
485 | All = All[c:]
486 | await event.eor(Text)
487 | offset += 1
488 | return
489 | if "|" in input_str:
490 | text, cmd = input_str.split("|", maxsplit=1)
491 | elif input_str is not None:
492 | cmd = None
493 | text = input_str
494 | else:
495 | await event.eor("Please add some text to figlet")
496 | return
497 | if cmd is not None:
498 | try:
499 | font = CMD_SET[cmd]
500 | except KeyError:
501 | await event.eor("Invalid selected font.")
502 | return
503 | result = pyfiglet.figlet_format(text, font=font)
504 | else:
505 | result = pyfiglet.figlet_format(text)
506 | await event.eor(f"`{result}`")
507 |
--------------------------------------------------------------------------------
/findsong.py:
--------------------------------------------------------------------------------
1 | # Ultroid Userbot
2 | # Made by senku
3 |
4 | """
5 | ✘ Commands Available
6 |
7 | • `{i}findsong `
8 | Identify the song name
9 | """
10 |
11 | from telethon.errors.rpcerrorlist import YouBlockedUserError
12 |
13 | from . import *
14 |
15 |
16 | @ultroid_cmd(pattern="findsong$")
17 | async def _(event):
18 | if not event.reply_to_msg_id:
19 | return await event.eor("Reply to an audio message.")
20 | reply_message = await event.get_reply_message()
21 | chat = "@auddbot"
22 | snku = await event.eor("Identifying the song")
23 | async with event.client.conversation(chat) as conv:
24 | try:
25 | await conv.send_message("/start")
26 | await conv.get_response()
27 | await conv.send_message(reply_message)
28 | check = await conv.get_response()
29 | if not check.text.startswith("Audio received"):
30 | return await snku.edit(
31 | "An error while identifying the song. Try to use a 5-10s long audio message."
32 | )
33 | await snku.edit("Wait just a sec...")
34 | result = await conv.get_response()
35 | await event.client.send_read_acknowledge(conv.chat_id)
36 | except YouBlockedUserError:
37 | await snku.edit("Please unblock (@auddbot) and try again")
38 | return
39 | namem = f"**Song Name : **{result.text.splitlines()[0]}\
40 | \n\n**Details : **__{result.text.splitlines()[2]}__"
41 | await snku.edit(namem)
42 |
--------------------------------------------------------------------------------
/flaticon.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 |
9 | """
10 | ✘ Commands Available
11 |
12 | • `{i}icon `
13 | Icon search from flaticon.com and uploading as sticker.
14 | """
15 |
16 | import os
17 | import random
18 |
19 | from bs4 import BeautifulSoup as bs
20 |
21 | from . import LOGS, ultroid_cmd, download_file, async_searcher, get_string
22 |
23 |
24 | @ultroid_cmd(pattern="icon ?(.*)")
25 | async def www(e):
26 | a = e.pattern_match.group(1)
27 | if not a:
28 | return await e.eor("Give some Text to Get Icon from Flaticon.com")
29 | tt = await e.eor(get_string("com_1"))
30 | query = a.replace(" ", "%20")
31 | try:
32 | link = f"https://www.flaticon.com/search?word={query}"
33 | ge = await async_searcher(link)
34 | cl = bs(ge, "html.parser", from_encoding="utf-8")
35 | results = cl.find_all(
36 | "img", src="https://media.flaticon.com/dist/min/img/loader.gif"
37 | )
38 | dome = results[random.randrange(0, len(results) - 1)]["data-src"]
39 | await download_file(dome, "sticker.webp")
40 | await e.reply(file="sticker.webp")
41 | os.remove("sticker.webp")
42 | await tt.delete()
43 | except Exception as E:
44 | LOGS.info(E)
45 | await tt.edit("`No Results Found`")
46 |
--------------------------------------------------------------------------------
/fontsnew.py:
--------------------------------------------------------------------------------
1 | #
2 | # Credits @chewmo
3 | #
4 | # Ported for Ultroid < https://github.com/TeamUltroid/Ultroid >
5 | #
6 |
7 | """
8 | ✘ Commands Available -
9 |
10 | • `{i}weeb `
11 | turns text to 山乇乇乃 font
12 |
13 | • `{i}tantext `
14 | turns text to ᎿᎯᏁᎿᏋメᎿ font
15 |
16 | • `{i}linetext `
17 | turns text to 𝕃𝕀ℕ𝔼𝕋𝔼𝕏𝕋
18 |
19 | • `{i}boxtext `
20 | turns text to 🄱🄾🅇🅃🄴🅇🅃
21 |
22 | • `{i}bubbletext `
23 | turns text to ⒷⓊⒷⒷⓁⒺⓉⒺⓍⓉ
24 |
25 | • `{i}cursive `
26 | turns text to 𝓬𝓾𝓻𝓼𝓲𝓿𝓮 font
27 |
28 | • `{i}greekify `
29 | turns text to ϑгεεκιғψ font
30 |
31 | • `{i}sorcify `
32 | turns text to ֆօʀƈɛʀɛʀ font
33 |
34 | • `{i}fraktify `
35 | turns text to 𝖋𝖗𝖆𝖐𝖙𝖚𝖗𝖊 font
36 |
37 | • `{i}rusify `
38 | turns text to яц$їfч font
39 | """
40 |
41 |
42 | normiefont = [
43 | "a",
44 | "b",
45 | "c",
46 | "d",
47 | "e",
48 | "f",
49 | "g",
50 | "h",
51 | "i",
52 | "j",
53 | "k",
54 | "l",
55 | "m",
56 | "n",
57 | "o",
58 | "p",
59 | "q",
60 | "r",
61 | "s",
62 | "t",
63 | "u",
64 | "v",
65 | "w",
66 | "x",
67 | "y",
68 | "z",
69 | ]
70 | weebyfont = [
71 | "卂",
72 | "乃",
73 | "匚",
74 | "刀",
75 | "乇",
76 | "下",
77 | "厶",
78 | "卄",
79 | "工",
80 | "丁",
81 | "长",
82 | "乚",
83 | "从",
84 | "𠘨",
85 | "口",
86 | "尸",
87 | "㔿",
88 | "尺",
89 | "丂",
90 | "丅",
91 | "凵",
92 | "リ",
93 | "山",
94 | "乂",
95 | "丫",
96 | "乙",
97 | ]
98 | tantextfont = [
99 | "Ꭿ",
100 | "Ᏸ",
101 | "Ꮳ",
102 | "Ꮄ",
103 | "Ꮛ",
104 | "Ꮄ",
105 | "Ꮆ",
106 | "Ꮒ",
107 | "i",
108 | "Ꮰ",
109 | "Ꮶ",
110 | "l",
111 | "m",
112 | "Ꮑ",
113 | "Ꮻ",
114 | "Ꮅ",
115 | "Ꮔ",
116 | "ᖇ",
117 | "Ꭶ",
118 | "Ꮏ",
119 | "Ꮜ",
120 | "Ꮙ",
121 | "Ꮿ",
122 | "メ",
123 | "Ꭹ",
124 | "Ꮓ",
125 | ]
126 | linetextfont = [
127 | "𝔸",
128 | "𝔹",
129 | "ℂ",
130 | "𝔻",
131 | "𝔼",
132 | "𝔽",
133 | "𝔾",
134 | "ℍ",
135 | "𝕀",
136 | "𝕁",
137 | "𝕂",
138 | "𝕃",
139 | "𝕄",
140 | "ℕ",
141 | "𝕆",
142 | "ℙ",
143 | "ℚ",
144 | "ℝ",
145 | "𝕊",
146 | "𝕋",
147 | "𝕌",
148 | "𝕍",
149 | "𝕎",
150 | "𝕏",
151 | "𝕐",
152 | "ℤ",
153 | ]
154 | boxtextfont = [
155 | "🄰",
156 | "🄱",
157 | "🄲",
158 | "🄳",
159 | "🄴",
160 | "🄵",
161 | "🄶",
162 | "🄷",
163 | "🄸",
164 | "🄹",
165 | "🄺",
166 | "🄻",
167 | "🄼",
168 | "🄽",
169 | "🄾",
170 | "🄿",
171 | "🅀",
172 | "🅁",
173 | "🅂",
174 | "🅃",
175 | "🅄",
176 | "🅅",
177 | "🅆",
178 | "🅇",
179 | "🅈",
180 | "🅉",
181 | ]
182 | bubbletextfont = [
183 | "Ⓐ",
184 | "Ⓑ",
185 | "Ⓒ",
186 | "Ⓓ",
187 | "Ⓔ",
188 | "Ⓕ",
189 | "Ⓖ",
190 | "Ⓗ",
191 | "Ⓘ",
192 | "Ⓙ",
193 | "Ⓚ",
194 | "Ⓛ",
195 | "Ⓜ",
196 | "Ⓝ",
197 | "Ⓞ",
198 | "Ⓟ",
199 | "Ⓠ",
200 | "Ⓡ",
201 | "Ⓢ",
202 | "Ⓣ",
203 | "Ⓤ",
204 | "Ⓥ",
205 | "Ⓦ",
206 | "Ⓧ",
207 | "Ⓨ",
208 | "Ⓩ",
209 | ]
210 | cursivefont = [
211 | "𝓪",
212 | "𝓫",
213 | "𝓬",
214 | "𝓭",
215 | "𝓮",
216 | "𝓯",
217 | "𝓰",
218 | "𝓱",
219 | "𝓲",
220 | "𝓳",
221 | "𝓴",
222 | "𝓵",
223 | "𝓶",
224 | "𝓷",
225 | "𝓸",
226 | "𝓹",
227 | "𝓺",
228 | "𝓻",
229 | "𝓼",
230 | "𝓽",
231 | "𝓾",
232 | "𝓿",
233 | "𝔀",
234 | "𝔁",
235 | "𝔂",
236 | "𝔃",
237 | ]
238 | greekfont = [
239 | "λ",
240 | "ϐ",
241 | "ς",
242 | "d",
243 | "ε",
244 | "ғ",
245 | "ϑ",
246 | "н",
247 | "ι",
248 | "ϳ",
249 | "κ",
250 | "l",
251 | "ϻ",
252 | "π",
253 | "σ",
254 | "ρ",
255 | "φ",
256 | "г",
257 | "s",
258 | "τ",
259 | "υ",
260 | "v",
261 | "ш",
262 | "ϰ",
263 | "ψ",
264 | "z",
265 | ]
266 | sorcererfont = [
267 | "ǟ",
268 | "ɮ",
269 | "ƈ",
270 | "ɖ",
271 | "ɛ",
272 | "ʄ",
273 | "ɢ",
274 | "ɦ",
275 | "ɨ",
276 | "ʝ",
277 | "ӄ",
278 | "ʟ",
279 | "ʍ",
280 | "ռ",
281 | "օ",
282 | "ք",
283 | "զ",
284 | "ʀ",
285 | "ֆ",
286 | "ȶ",
287 | "ʊ",
288 | "ʋ",
289 | "ա",
290 | "Ӽ",
291 | "ʏ",
292 | "ʐ",
293 | ]
294 | frakturfont = [
295 | "𝖆",
296 | "𝖇",
297 | "𝖈",
298 | "𝖉",
299 | "𝖊",
300 | "𝖋",
301 | "𝖌",
302 | "𝖍",
303 | "𝖎",
304 | "𝖏",
305 | "𝖐",
306 | "𝖑",
307 | "𝖒",
308 | "𝖓",
309 | "𝖔",
310 | "𝖕",
311 | "𝖖",
312 | "𝖗",
313 | "𝖘",
314 | "𝖙",
315 | "𝖚",
316 | "𝖛",
317 | "𝖜",
318 | "𝖝",
319 | "𝖞",
320 | "𝖟",
321 | ]
322 | rusifont = [
323 | "а",
324 | "б",
325 | "c",
326 | "д",
327 | "ё",
328 | "f",
329 | "g",
330 | "н",
331 | "ї",
332 | "j",
333 | "к",
334 | "г",
335 | "ѫ",
336 | "п",
337 | "ѳ",
338 | "p",
339 | "ф",
340 | "я",
341 | "$",
342 | "т",
343 | "ц",
344 | "ѵ",
345 | "щ",
346 | "ж",
347 | "ч",
348 | "з",
349 | ]
350 |
351 |
352 | @ultroid_cmd(pattern="weeb ?(.*)")
353 | async def weebify(ult):
354 | args = ult.pattern_match.group(1)
355 | if not args and ult.is_reply:
356 | get = await ult.get_reply_message()
357 | args = get.text
358 | if not args:
359 | await ult.edit("What I am Supposed to Weebify? Please Give Text Sir")
360 | return
361 | string = "".join(args).lower()
362 | for normiecharacter in string:
363 | if normiecharacter in normiefont:
364 | weebycharacter = weebyfont[normiefont.index(normiecharacter)]
365 | string = string.replace(normiecharacter, weebycharacter)
366 | await ult.eor(string)
367 |
368 |
369 | @ultroid_cmd(pattern="tantext ?(.*)")
370 | async def tantxt(ult):
371 | args = ult.pattern_match.group(1)
372 | if not args and ult.is_reply:
373 | get = await ult.get_reply_message()
374 | args = get.text
375 | if not args:
376 | await ult.edit("What I am Supposed to tanify? Please Give Text Sir")
377 | return
378 | string = "".join(args).lower()
379 | for normiecharacter in string:
380 | if normiecharacter in normiefont:
381 | tanycharacter = tantextfont[normiefont.index(normiecharacter)]
382 | string = string.replace(normiecharacter, tanycharacter)
383 | await ult.eor(string)
384 |
385 |
386 | @ultroid_cmd(pattern="linetext ?(.*)")
387 | async def linetxt(ult):
388 | args = ult.pattern_match.group(1)
389 | if not args and ult.is_reply:
390 | get = await ult.get_reply_message()
391 | args = get.text
392 | if not args:
393 | await ult.edit("What I am Supposed to linefy? Please Give Text Sir")
394 | return
395 | string = "".join(args).lower()
396 | for normiecharacter in string:
397 | if normiecharacter in normiefont:
398 | linecharacter = linetextfont[normiefont.index(normiecharacter)]
399 | string = string.replace(normiecharacter, linecharacter)
400 | await ult.edit(string)
401 |
402 |
403 | @ultroid_cmd(pattern="boxtext ?(.*)")
404 | async def boxtxt(ult):
405 | args = ult.pattern_match.group(1)
406 | if not args and ult.is_reply:
407 | get = await ult.get_reply_message()
408 | args = get.text
409 | if not args:
410 | return await ult.edit("What I am Supposed to boxify? Please Give Text Sir")
411 | string = "".join(args).lower()
412 | for normiecharacter in string:
413 | if normiecharacter in normiefont:
414 | boxcharacter = boxtextfont[normiefont.index(normiecharacter)]
415 | string = string.replace(normiecharacter, boxcharacter)
416 | await ult.eor(string)
417 |
418 |
419 | @ultroid_cmd(pattern="bubbletext ?(.*)")
420 | async def bubbletxt(ult):
421 | args = ult.pattern_match.group(1)
422 | if not args and ult.is_reply:
423 | get = await ult.get_reply_message()
424 | args = get.text
425 | if not args:
426 | return await ult.edit("What I am Supposed to bubblify? Please Give Text Sir")
427 | string = "".join(args).lower()
428 | for normiecharacter in string:
429 | if normiecharacter in normiefont:
430 | bubblecharacter = bubbletextfont[normiefont.index(normiecharacter)]
431 | string = string.replace(normiecharacter, bubblecharacter)
432 | await ult.eor(string)
433 |
434 |
435 | @ultroid_cmd(pattern="cursive ?(.*)")
436 | async def cursive(ult):
437 | args = ult.pattern_match.group(1)
438 | if not args and ult.is_reply:
439 | get = await ult.get_reply_message()
440 | args = get.text
441 | if not args:
442 | return await ult.edit(
443 | "What I am Supposed to write in cursive? Please Give Text Sir"
444 | )
445 | string = "".join(args).lower()
446 | for normiecharacter in string:
447 | if normiecharacter in normiefont:
448 | cursivecharacter = cursivefont[normiefont.index(normiecharacter)]
449 | string = string.replace(normiecharacter, cursivecharacter)
450 | await ult.eor(string)
451 |
452 |
453 | @ultroid_cmd(pattern="greekify ?(.*)")
454 | async def greektext(ult):
455 | args = ult.pattern_match.group(1)
456 | if not args and ult.is_reply:
457 | get = await ult.get_reply_message()
458 | args = get.text
459 | if not args:
460 | return await ult.edit("What I am Supposed to greekify? Please Give Text Sir")
461 | string = "".join(args).lower()
462 | for normiecharacter in string:
463 | if normiecharacter in normiefont:
464 | greekcharacter = greekfont[normiefont.index(normiecharacter)]
465 | string = string.replace(normiecharacter, greekcharacter)
466 | await ult.eor(string)
467 |
468 |
469 | @ultroid_cmd(pattern="sorcify ?(.*)")
470 | async def sorcerertext(ult):
471 |
472 | args = ult.pattern_match.group(1)
473 | if not args and ult.is_reply:
474 | get = await ult.get_reply_message()
475 | args = get.text
476 | if not args:
477 | await ult.edit("What I am Supposed to sorcify? Please Give Text Sir")
478 | return
479 | string = "".join(args).lower()
480 | for normiecharacter in string:
481 | if normiecharacter in normiefont:
482 | sorcerercharacter = sorcererfont[normiefont.index(normiecharacter)]
483 | string = string.replace(normiecharacter, sorcerercharacter)
484 | await ult.eor(string)
485 |
486 |
487 | @ultroid_cmd(pattern="fraktify ?(.*)")
488 | async def frakturtext(ult):
489 | args = ult.pattern_match.group(1)
490 | if not args and ult.is_reply:
491 | get = await ult.get_reply_message()
492 | args = get.text
493 | if not args:
494 | await ult.edit("What I am Supposed to fraktify? Please Give Text Sir")
495 | return
496 | string = "".join(args).lower()
497 | for normiecharacter in string:
498 | if normiecharacter in normiefont:
499 | frakturcharacter = frakturfont[normiefont.index(normiecharacter)]
500 | string = string.replace(normiecharacter, frakturcharacter)
501 | await ult.eor(string)
502 |
503 |
504 | @ultroid_cmd(pattern="rusify ?(.*)")
505 | async def rusitext(ult):
506 | args = ult.pattern_match.group(1)
507 | if not args and ult.is_reply:
508 | get = await ult.get_reply_message()
509 | args = get.text
510 | if not args:
511 | return await ult.edit("What I am Supposed to rusify? Please Give Text Sir")
512 | string = "".join(args).lower()
513 | for normiecharacter in string:
514 | if normiecharacter in normiefont:
515 | rusicharacter = rusifont[normiefont.index(normiecharacter)]
516 | string = string.replace(normiecharacter, rusicharacter)
517 | await ult.eor(string)
518 |
--------------------------------------------------------------------------------
/fun.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available
10 |
11 | • `{i}joke`
12 | To get joke.
13 |
14 | • `{i}url `
15 | To get a shorten link of long link.
16 |
17 | • `{i}phlogo `
18 | Make a phub based logo.
19 |
20 | • `{i}decide`
21 | Decide something.
22 |
23 | • `{i}xo`
24 | Opens tic tac game only where using inline mode is allowed.
25 |
26 | • `{i}wordi`
27 | Opens word game only where using inline mode is allowed.
28 |
29 | • `{i}gps `
30 | Shows the desired place in the map.
31 | """
32 |
33 | import random, os
34 |
35 | import requests
36 | from bs4 import BeautifulSoup as bs
37 | from pyjokes import get_joke
38 | from telethon.errors import ChatSendMediaForbiddenError
39 | from phlogo import generate
40 |
41 | from . import ultroid_cmd, get_string, HNDLR, async_searcher
42 |
43 |
44 | @ultroid_cmd(pattern="joke$")
45 | async def _(ult):
46 | await ult.eor(get_joke())
47 |
48 |
49 | @ultroid_cmd(pattern="url ?(.*)")
50 | async def _(event):
51 | input_str = event.pattern_match.group(1)
52 | if not input_str:
53 | await event.eor("`Give some url`")
54 | return
55 | sample_url = "https://da.gd/s?url={}".format(input_str)
56 | response_api = requests.get(sample_url).text
57 | if response_api:
58 | await event.eor(
59 | "**Shortened url**==> {}\n**Given url**==> {}.".format(
60 | response_api, input_str
61 | ),
62 | )
63 | else:
64 | await event.eor("`Something went wrong. Please try again Later.`")
65 |
66 |
67 | @ultroid_cmd(pattern="decide$")
68 | async def _(event):
69 | hm = await event.eor("`Deciding`")
70 | r = await async_searcher("https://yesno.wtf/api", re_json=True)
71 | try:
72 | await event.reply(r["answer"], file=r["image"])
73 | await hm.delete()
74 | except ChatSendMediaForbiddenError:
75 | await event.eor(r["answer"])
76 |
77 |
78 | @ultroid_cmd(pattern="xo$")
79 | async def xo(ult):
80 | xox = await ult.client.inline_query("xobot", "play")
81 | await xox[random.randrange(0, len(xox) - 1)].click(
82 | ult.chat_id, reply_to=ult.reply_to_msg_id, silent=True, hide_via=True
83 | )
84 | await ult.delete()
85 |
86 |
87 | @ultroid_cmd(pattern="phlogo( (.*)|$)")
88 | async def make_logog(ult):
89 | msg = await ult.eor(get_string("com_1"))
90 | match = ult.pattern_match.group(1).strip()
91 | reply = await ult.get_reply_message()
92 | if not match and (reply and reply.text):
93 | match = reply.text
94 | else:
95 | return await msg.edit(f"`Provide a name to make logo...`")
96 | first, last = "", ""
97 | if len(match.split()) >= 2:
98 | first, last = match.split()[:2]
99 | else:
100 | last = match
101 | logo = generate(first, last)
102 | name = f"{ult.id}.png"
103 | logo.save(name)
104 | await ult.client.send_message(
105 | ult.chat_id, file=name, reply_to=ult.reply_to_msg_id or ult.id
106 | )
107 | os.remove(name)
108 | await msg.delete()
109 |
110 |
111 | Bot = {"gps":"openmap_bot", "wordi":"wordibot"}
112 |
113 | @ultroid_cmd(pattern="(gps|wordi) (.*)")
114 | async def _map(ult):
115 | cmd = ult.pattern_match.group(1)
116 | get = ult.pattern_match.group(2)
117 | if not get:
118 | return await ult.eor(f"Use this command as `{HNDLR}{cmd} `")
119 | quer = await ult.client.inline_query(Bot[cmd], get)
120 | await quer[0].click(
121 | ult.chat_id, reply_to=ult.reply_to_msg_id, silent=True, hide_via=True
122 | )
123 | await ult.delete()
124 |
--------------------------------------------------------------------------------
/hack.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available
10 |
11 | • `{i}hack`
12 | Do a Prank With Replied user.
13 |
14 | """
15 |
16 | import asyncio
17 | import random
18 |
19 | from . import *
20 |
21 |
22 | @ultroid_cmd(pattern="hack")
23 | async def _(event):
24 | animation_interval = 0.7
25 | animation_ttl = range(0, 11)
26 | xx = await event.eor("Installing..")
27 | animation_chars = [
28 | "`Installing Files To Hacked Private Server...`",
29 | "`Target Selected.`",
30 | "`Installing... 0%\n▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
31 | "`Installing... 4%\n█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
32 | "`Installing... 8%\n██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
33 | "`lnstallig... 20%\n█████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
34 | "`Installing... 36%\n█████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
35 | "`Installing... 52%\n█████████████▒▒▒▒▒▒▒▒▒▒▒▒ `",
36 | "`Installing... 84%\n█████████████████████▒▒▒▒ `",
37 | "`Installing... 100%\n████████Installed██████████ `",
38 | "`Target files Uploading...\n\nDirecting To Remote server to hack..`",
39 | ]
40 | for i in animation_ttl:
41 | await asyncio.sleep(animation_interval)
42 | await xx.edit(animation_chars[i % 11])
43 | await asyncio.sleep(2)
44 | animation_interval = 0.6
45 | animation_ttl = range(0, 14)
46 | await xx.edit("`Connecting nd getting combined token from my.telegram.org`")
47 | await asyncio.sleep(1)
48 | animation_chars = [
49 | "`root@anon:~#` ",
50 | "`root@anon:~# ls`",
51 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~#`",
52 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...`",
53 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# `",
54 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py`",
55 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...`",
56 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...`",
57 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...\n\nroot@anon:~# trap whoami`",
58 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...\n\nroot@anon:~# trap whoami\n\nwhoami=user`",
59 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...\n\nroot@anon:~# trap whoami\n\nwhoami=user\nboost_trap on force ...`",
60 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...\n\nroot@anon:~# trap whoami\n\nwhoami=user\nboost_trap on force ...\nvictim detected in ghost ...`",
61 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...\n\nroot@anon:~# trap whoami\n\nwhoami=user\nboost_trap on force ...\nvictim detected in ghost ...\n\nAll Done!`",
62 | "`root@anon:~# ls\n\n usr ghost codes \n\nroot@aono:~# # So Let's Hack it ...\nroot@anon:~# touch setup.py\n\nsetup.py deployed ...\nAuto CMD deployed ...\n\nroot@anon:~# trap whoami\n\nwhoami=user\nboost_trap on force ...\nvictim detected in ghost ...\n\nAll Done!\nInstalling Token!\nToken=`DJ65gulO90P90nlkm65dRfc8I`",
63 | ]
64 | for i in animation_ttl:
65 | await asyncio.sleep(animation_interval)
66 | await xx.edit(animation_chars[i % 14])
67 | await asyncio.sleep(2)
68 | await xx.edit("`starting telegram hack`")
69 | await asyncio.sleep(1)
70 | # credit to kraken,sawan
71 | await xx.edit(
72 | "`hacking... 0%completed.\nTERMINAL:\nDownloading Bruteforce-Telegram-0.1.tar.gz (1.3) kB`"
73 | )
74 | await asyncio.sleep(2)
75 | await xx.edit(
76 | " `hacking... 4% completed\n TERMINAL:\nDownloading Bruteforce-Telegram-0.1.tar.gz (9.3 kB)\nCollecting Data Package`"
77 | )
78 | await asyncio.sleep(1)
79 | await xx.edit(
80 | "`hacking.....6% completed\n TERMINAL:\nDownloading Bruteforce-Telegram-0.1.tar.gz (9.3 kB)\nCollecting Data Packageseeing target account chat\n lding chat tg-bot bruteforce finished`"
81 | )
82 | await asyncio.sleep(1)
83 | await xx.edit(
84 | "`hacking.....8%completed\n TERMINAL:\nDownloading Bruteforce-Telegram-0.1.tar.gz (9.3 kB)\nCollecting Data Packageseeing target account chat\n lding chat tg-bot bruteforce finished\n creating pdf of chat`"
85 | )
86 | await asyncio.sleep(1)
87 | await xx.edit(
88 | "`hacking....15%completed\n Terminal:chat history from telegram exporting to private database.\n terminal 874379gvrfghhuu5tlotruhi5rbh installing`"
89 | )
90 | await asyncio.sleep(1)
91 | await xx.edit(
92 | "`hacking....24%completed\n TERMINAL:\nDownloading Bruteforce-Telegram-0.1.tar.gz (9.3 kB)\nCollecting Data Packageseeing target account chat\n lding chat tg-bot bruteforce finished\nerminal:chat history from telegram exporting to private database.\n terminal 874379gvrfghhuu5tlotruhi5rbh installed\n creting data into pdf`"
93 | )
94 | await asyncio.sleep(1)
95 | await xx.edit(
96 | "`hacking....32%completed\n looking for use history \n downloading-telegram -id prtggtgf . gfr (12.99 mb)\n collecting data starting imprute attack to user account\n chat history from telegram exporting to private database.\n terminal 874379gvrfghhuu5tlotruhi5rbh installed\n creted data into pdf\nDownload sucessful Bruteforce-Telegram-0.1.tar.gz (1.3)`"
97 | )
98 | await asyncio.sleep(1)
99 | await xx.edit(
100 | "`hacking....38%completed\n\nDownloading Bruteforce-Telegram-0.1.tar.gz (9.3 kB)\nCollecting Data Package\n Downloading Telegram-Data-Sniffer-7.1.1-py2.py3-none-any.whl (82 kB): finished with status 'done'\nCreated wheel for telegram: filename=Telegram-Data-Sniffer-0.0.1-py3-none-any.whl size=1306 sha256=cb224caad7fe01a6649188c62303cd4697c1869fa12d280570bb6ac6a88e6b7e`"
101 | )
102 | await asyncio.sleep(1)
103 | await xx.edit(
104 | "`hacking....52%completed\nexterting data from telegram private server\ndone with status 36748hdeg \n checking for more data in device`"
105 | )
106 | await asyncio.sleep(2)
107 | await xx.edit(
108 | "`hacking....60%completed\nmore data found im target device\npreparing to download data\n process started with status 7y75hsgdt365ege56es \n status changed to up`"
109 | )
110 | await asyncio.sleep(1)
111 | await xx.edit(
112 | "`hacking....73% completed\n downloading data from device\n process completed with status 884hfhjh\nDownloading-0.1.tar.gz (9.3 kB)\nCollecting Data Packageseeing target\n lding chat tg-bot bruteforce finished\n creating pdf of chat`"
113 | )
114 | await asyncio.sleep(1)
115 | await xx.edit(
116 | "`hacking...88%completed\nall data from telegram private server downloaded\nterminal download sucessfull--with status jh3233fdg66y yr4vv.irh\n data collected from tg-bot\nTERMINAL:\n Bruteforce-Telegram-0.1.tar.gz (1.3)downloaded`"
117 | )
118 | await asyncio.sleep(0.5)
119 | await xx.edit(
120 | "`100%\n█████████HACKED███████████ `\n\n\n TERMINAL:\nDownloading Bruteforce-Telegram-0.1.tar.gz (9.3 kB)\nCollecting Data Package\n Downloading Telegram-Data-Sniffer-7.1.1-py2.py3-none-any.whl (82 kB)\nBuilding wheel for Tg-Bruteforcing (setup.py): finished with status 'done'\nCreated wheel for telegram: filename=Telegram-Data-Sniffer-0.0.1-py3-none-any.whl size=1306 sha256=cb224caad7fe01a6649188c62303cd4697c1869fa12d280570bb6ac6a88e6b7e\n Stored in directory: `"
121 | )
122 | await asyncio.sleep(2)
123 | await xx.edit("`account hacked\n collecting all data\n converting data into pdf`")
124 | await asyncio.sleep(1)
125 | sub = "https://drive.google.com/file/d/"
126 | LINKS = [
127 | "1JNA0HY1v8ClBDU9PhmyQ-z8KuLgvteT5/view?usp=sharing",
128 | "1HXclQumyRIRy9STTiHcTAHpSMM2mj5ZF/view?usp=sharing",
129 | ]
130 | ME = sub + LINKS[random.randrange(0, len(LINKS))]
131 | MSG = "`pdf created click link below to download data\n\n"
132 | MSG += " Don't worry only i can open this 😎😎.. If u don't"
133 | MSG += f" Believe me, try to download` 🙂\n\n{ME}"
134 | await xx.edit(MSG)
135 |
--------------------------------------------------------------------------------
/howto.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}htg `
12 | How To Google.
13 | Some peoples don't know how to google so help them 🙃🙂.
14 |
15 | • `{i}htd `
16 | How to duck duck go...
17 | """
18 |
19 |
20 | from . import ultroid_cmd, async_searcher
21 |
22 |
23 | API = {"g": "lmgtfy.com/?q={}%26iie=1", "d": "lmddgtfy.net/?q={}"}
24 |
25 |
26 | @ultroid_cmd(pattern="ht(g|d)( ?(.*)|$)")
27 | async def _(e):
28 | key = e.pattern_match.group(1)
29 | text = e.pattern_match.group(2)
30 | if not text:
31 | return await e.eor("`Give some text`", time=5)
32 | url = "https://da.gd/s?url=https://" + API[key].format(text.replace(" ", "+"))
33 | response = await async_searcher(url)
34 | if response:
35 | return await e.eor(
36 | "[{}]({})\n`Thank me Later 🙃` ".format(text, response.rstrip()), time=8
37 | )
38 | await e.eor("`something is wrong. please try again later.`")
39 |
--------------------------------------------------------------------------------
/imdb.py:
--------------------------------------------------------------------------------
1 | # Ultroid Userbot
2 | #
3 |
4 | """
5 | Search movie details from IMDB
6 |
7 | ✘ Commands Available
8 | • `{i}imdb `
9 | """
10 |
11 | from . import *
12 |
13 |
14 | @ultroid_cmd(pattern="imdb ?(.*)")
15 | async def imdb(e):
16 | m = await e.eor("`...`")
17 | movie_name = e.pattern_match.group(1)
18 | if not movie_name:
19 | return await eor(m, "`Provide a movie name too`")
20 | try:
21 | mk = await e.client.inline_query("imdbot", movie_name)
22 | await mk[0].click(e.chat_id)
23 | await m.delete()
24 | except IndexError:
25 | return await eor(m, "No Results Found...")
26 | except Exception as er:
27 | return await eor(m, str(er))
--------------------------------------------------------------------------------
/inline/__init__.py:
--------------------------------------------------------------------------------
1 | from .. import *
2 |
--------------------------------------------------------------------------------
/inline/ghfeeds.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 |
9 | from telethon.tl.custom import Button
10 | from . import in_pattern, InlinePlugin, async_searcher, asst
11 | from telethon.tl.types import InputWebDocument
12 |
13 | __doc__ = f"""
14 | ✘ Commands Available -
15 | • `@{asst.username} gh .`
16 | Searches for the Github username and returns the latest feeds.
17 | End your query with a dot (.) to search.
18 | """
19 |
20 | @in_pattern("gh", owner=True)
21 | async def gh_feeds(ult):
22 | try:
23 | username = ult.text.split(maxsplit=1)[1]
24 | except IndexError:
25 | await ult.answer(
26 | [],
27 | switch_pm="Enter Github Username to see feeds...",
28 | switch_pm_param="start",
29 | )
30 | return
31 | if not username.endswith("."):
32 | return await ult.answer(
33 | [], switch_pm="End your query with . to search...", switch_pm_param="start"
34 | )
35 | username = username[:-1]
36 | data = await async_searcher(
37 | f"https://api.github.com/users/{username}/events", re_json=True
38 | )
39 | if not isinstance(data, list):
40 | msg = "".join(f"{ak}: `{data[ak]}" + "`\n" for ak in list(data.keys()))
41 | return await ult.answer(
42 | [
43 | await ult.builder.article(
44 | title=data["message"], text=msg, link_preview=False
45 | )
46 | ],
47 | cache_time=300,
48 | switch_pm="Error!!!",
49 | switch_pm_param="start",
50 | )
51 | res = []
52 | res_ids = []
53 | for cont in data[:50]:
54 | text = f"@{username}"
55 | title = f"@{username}"
56 | extra = None
57 | if cont["type"] == "PushEvent":
58 | text += " pushed in"
59 | title += " pushed in"
60 | dt = cont["payload"]["commits"][-1]
61 | url = "https://github.com/" + dt["url"].split("/repos/")[-1]
62 | extra = f"\n-> message: {dt['message']}
"
63 | elif cont["type"] == "IssueCommentEvent":
64 | title += " commented at"
65 | text += " commented at"
66 | url = cont["payload"]["comment"]["html_url"]
67 | elif cont["type"] == "CreateEvent":
68 | title += " created"
69 | text += " created"
70 | url = "https://github.com/" + cont["repo"]["name"]
71 | elif cont["type"] == "PullRequestEvent":
72 | if (
73 | cont["payload"]["pull_request"].get("user", {}).get("login")
74 | != username.lower()
75 | ):
76 | continue
77 | url = cont["payload"]["pull_request"]["html_url"]
78 | text += " created a pull request in"
79 | title += " created a pull request in"
80 | elif cont["type"] == "ForkEvent":
81 | text += " forked"
82 | title += " forked"
83 | url = cont["payload"]["forkee"]["html_url"]
84 | else:
85 | continue
86 | repo = cont["repo"]["name"]
87 | repo_url = f"https://github.com/{repo}"
88 | title += f" {repo}"
89 | text += f" {repo}"
90 | if extra:
91 | text += extra
92 | thumb = InputWebDocument(cont["actor"]["avatar_url"], 0, "image/jpeg", [])
93 | article = await ult.builder.article(
94 | title=title,
95 | text=text,
96 | url=repo_url,
97 | parse_mode="html",
98 | link_preview=False,
99 | thumb=thumb,
100 | buttons=[
101 | Button.url("View", url),
102 | Button.switch_inline("Search again", query=ult.text, same_peer=True),
103 | ],
104 | )
105 | if article.id not in res_ids:
106 | res_ids.append(article.id)
107 | res.append(article)
108 | msg = f"Showing {len(res)} feeds!" if res else "Nothing Found"
109 | await ult.answer(res, cache_time=5000, switch_pm=msg, switch_pm_param="start")
110 |
111 | InlinePlugin.update({"GɪᴛHᴜʙ ғᴇᴇᴅs": "gh"})
112 |
--------------------------------------------------------------------------------
/inline/imdb.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2024 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 | import hashlib
8 | import json
9 | import re
10 |
11 | import requests
12 | from bs4 import BeautifulSoup
13 | from telethon import Button
14 |
15 | try:
16 | from PIL import Image
17 | except ImportError:
18 | Image = None
19 |
20 | from telethon.tl.types import InputWebDocument as wb
21 |
22 | from . import LOGS, callback, in_pattern, udB, async_searcher, asst
23 |
24 | __doc__ = f"""
25 | ✘ Commands Available -
26 | • `@{asst.username} imdb `
27 | Searches for the movie on IMDb and returns the results.
28 | • `@{asst.username} imdb y=`
29 | Searches for the movie on IMDb by year and returns the results.
30 | """
31 |
32 | # Define your OMDB API key
33 | OMDB_API_KEY = udB.get_key("OMDb_API") #OpenMovies Database get free key from http://www.omdbapi.com/ with 1000 dailiy uses
34 | imdbp = "https://graph.org/file/3b45a9ed4868167954300.jpg"
35 |
36 | LIST = {}
37 | hash_to_url = {}
38 |
39 |
40 | def generate_unique_id(url):
41 | hashed_id = hashlib.sha256(url.encode()).hexdigest()[:8]
42 | hash_to_url[hashed_id] = url
43 | return hashed_id
44 |
45 |
46 | def get_original_url(hashed_id):
47 | return hash_to_url.get(hashed_id)
48 |
49 |
50 | async def get_movie_data(search_term, full_plot=False):
51 | if "y=" in search_term:
52 | parts = search_term.split("y=")
53 | if parts:
54 | LOGS.info(f"YEAR_prts: {parts}")
55 | movie_name = parts[0].strip()
56 | if movie_name:
57 | year = parts[1].strip() if len(parts) > 1 else None
58 | if year:
59 | SBY = True
60 | else:
61 | SBY = False
62 | else:
63 | SBY = False
64 | movie_name = search_term
65 | else:
66 | SBY = False
67 | movie_name = search_term
68 | else:
69 | SBY = False
70 | movie_name = search_term
71 |
72 | url = f"http://www.omdbapi.com/?apikey={OMDB_API_KEY}&t={movie_name}"
73 |
74 | if SBY is True:
75 | url += f"&y={year}"
76 | if full_plot is True:
77 | url += "&plot=full"
78 |
79 | data = await async_searcher(url, re_json=True)
80 | if data.get("Response") == "True":
81 | return data
82 | else:
83 | LOGS.info("Error: Unable to fetch movie data")
84 | return None
85 |
86 |
87 | def get_trailer(imdbID):
88 | url = f"https://www.imdb.com/title/{imdbID}/"
89 | headers = {"User-Agent": "Mozilla/5.0"}
90 |
91 | response = requests.get(url, headers=headers)
92 | if response.status_code == 200:
93 | soup = BeautifulSoup(response.content, "html.parser")
94 | script = soup.find("script", type="application/ld+json")
95 | data = json.loads(script.string)
96 | trailer_url = data.get("trailer", {}).get("embedUrl")
97 | if trailer_url:
98 | LOGS.info(f"Trailer URL: {trailer_url}")
99 | return f"{trailer_url}"
100 | else:
101 | LOGS.info("Could not find trailer link")
102 | return None
103 |
104 | else:
105 | LOGS.info("Error: Unable to fetch IMDb page")
106 | return None
107 |
108 |
109 | @in_pattern("imdb", owner=False)
110 | async def inline_imdb_command(event):
111 | try:
112 | movie_name = event.text.split(" ", maxsplit=1)[1]
113 | LOGS.info(f"QUERY\n{movie_name}")
114 | except IndexError:
115 | indexarticle = event.builder.article(
116 | title="Sᴇᴀʀᴄʜ Sᴏᴍᴇᴛʜɪɴɢ",
117 | thumb=wb(imdbp, 0, "image/jpeg", []),
118 | text="**Iᴍᴅʙ Sᴇᴀʀᴄʜ**\n\nʏᴏᴜ ᴅɪᴅɴ'ᴛ sᴇᴀʀᴄʜ ᴀɴʏᴛʜɪɴɢ",
119 | buttons=[
120 | Button.switch_inline(
121 | "Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
122 | query="imdb ",
123 | same_peer=True,
124 | ),
125 | Button.switch_inline(
126 | "Sᴇᴀʀᴄʜ Bʏ Yᴇᴀʀ",
127 | query="imdb IF y= 2024 ",
128 | same_peer=True,
129 | ),
130 | ],
131 | )
132 | await event.answer([indexarticle])
133 | return
134 |
135 | try:
136 | movie_data = await get_movie_data(movie_name)
137 | if movie_data:
138 | title = movie_data.get("Title", "")
139 | year = movie_data.get("Year", "")
140 | rated = movie_data.get("Rated", "")
141 | released = movie_data.get("Released", "")
142 | runtime = movie_data.get("Runtime", "")
143 | ratings = movie_data.get("Ratings", "")
144 | ratings_str = ", ".join(
145 | [f"{rating['Source']}: `{rating['Value']}`" for rating in ratings]
146 | )
147 | genre = movie_data.get("Genre", "")
148 | director = movie_data.get("Director", "")
149 | actors = movie_data.get("Actors", "")
150 | plot = movie_data.get("Plot", "")
151 | language = movie_data.get("Language", "")
152 | country = movie_data.get("Country", "")
153 | awards = movie_data.get("Awards", "")
154 | poster_url = movie_data.get("Poster", "")
155 | imdbRating = movie_data.get("imdbRating", "")
156 | imdbVotes = movie_data.get("imdbVotes", "")
157 | BoxOffice = movie_data.get("BoxOffice", "")
158 | imdbID = movie_data.get("imdbID", "")
159 | movie_details = (
160 | f"**Tɪᴛʟᴇ:** {title}\n"
161 | f"**Yᴇᴀʀ:** `{year}`\n"
162 | f"**Rᴀᴛᴇᴅ:** `{rated}`\n"
163 | f"**Rᴇʟᴇᴀsᴇᴅ:** {released}\n"
164 | f"**Rᴜɴᴛɪᴍᴇ:** `{runtime}`\n"
165 | f"**Gᴇɴʀᴇ:** {genre}\n"
166 | f"**Dɪʀᴇᴄᴛᴏʀ:** {director}\n"
167 | f"**Aᴄᴛᴏʀs:** {actors}\n"
168 | f"**Pʟᴏᴛ:** {plot}\n"
169 | f"**Lᴀɴɢᴜᴀɢᴇ:** `{language}`\n"
170 | f"**Cᴏᴜɴᴛʀʏ:** {country}\n"
171 | f"**Aᴡᴀʀᴅs:** {awards}\n"
172 | f"**Rᴀᴛɪɴɢs:** {ratings_str}\n"
173 | f"**IMDʙ Rᴀᴛɪɴɢ:** `{imdbRating}`\n"
174 | f"**IMDʙ Lɪɴᴋ:** https://www.imdb.com/title/{imdbID}\n"
175 | f"**ɪᴍᴅʙVᴏᴛᴇs:** `{imdbVotes}`\n"
176 | f"**BᴏxOғғɪᴄᴇ:** `{BoxOffice}`"
177 | )
178 | except Exception as er:
179 | LOGS.info(f"Exception: {er}")
180 |
181 | try:
182 | plot_id = generate_unique_id(movie_details)
183 | except UnboundLocalError:
184 | if " y= " in movie_name:
185 | noresult = movie_name.replace(" y= ", " ")
186 | elif "y= " in movie_name:
187 | noresult = movie_name.replace("y= ", "")
188 | elif "y=" in movie_name:
189 | noresult = movie_name.replace("y=", "")
190 | else:
191 | noresult = movie_name
192 |
193 | return await event.answer(
194 | [
195 | await event.builder.article(
196 | title="Nᴏ ʀᴇsᴜʟᴛs ғᴏᴜɴᴅ",
197 | text=f"**IMDʙ**\nTʀʏ ᴀɴᴏᴛʜᴇʀ sᴇᴀʀᴄʜ",
198 | thumb=wb(imdbp, 0, "image/jpeg", []),
199 | buttons=[
200 | Button.switch_inline(
201 | "Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
202 | query="imdb ",
203 | same_peer=True,
204 | ),
205 | Button.switch_inline(
206 | "Sᴇᴀʀᴄʜ Bʏ Yᴇᴀʀ",
207 | query=f"imdb {movie_name} y= ",
208 | same_peer=True,
209 | ),
210 | ],
211 | )
212 | ],
213 | switch_pm=f"{noresult}",
214 | switch_pm_param="start",
215 | )
216 | except Exception as er:
217 | LOGS.info(f"Exception: {er}")
218 | return
219 |
220 | txt = f"**Tɪᴛʟᴇ:** {title}\n**Rᴇʟᴇᴀsᴇᴅ:** {released}\n**Cᴏᴜɴᴛʀʏ:** {country}"
221 | button = [
222 | [Button.inline("Fᴜʟʟ Dᴇᴛᴀɪʟs", data=f"plot_button:{plot_id}")],
223 | [Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="imdb ", same_peer=True)],
224 | ]
225 |
226 | article = await event.builder.article(
227 | type="photo",
228 | text=txt,
229 | title=f"{title}",
230 | include_media=True,
231 | description=f"{released}\nɪᴍᴅʙ: {imdbRating}\nLᴀɴɢᴜᴀɢᴇ: {language}",
232 | link_preview=False,
233 | thumb=wb(poster_url, 0, "image/jpeg", []),
234 | content=wb(poster_url, 0, "image/jpeg", []),
235 | buttons=button,
236 | )
237 | LIST.update(
238 | {
239 | plot_id: {
240 | "text": txt,
241 | "buttons": button,
242 | "imdbID": imdbID,
243 | "movie_name": movie_name,
244 | "plot": plot,
245 | }
246 | }
247 | )
248 | await event.answer([article])
249 |
250 |
251 | @callback(re.compile("plot_button:(.*)"), owner=False)
252 | async def plot_button_clicked(event):
253 | plot_id = event.data.decode().split(":", 1)[1]
254 | details = get_original_url(plot_id)
255 | plot = LIST[plot_id]["plot"]
256 | imdbID = LIST[plot_id]["imdbID"]
257 | trailer_url = get_trailer(imdbID)
258 | btns = [
259 | [Button.inline("Back", data=f"imdb_back_button:{plot_id}")],
260 | ]
261 | if trailer_url:
262 | btns.insert(0, [Button.url("Trailer", url=trailer_url)])
263 | if plot.endswith("..."):
264 | btns.insert(
265 | 0, [Button.inline("Extended Plot", data=f"extended_plot:{plot_id}")]
266 | )
267 | await event.edit(details, buttons=btns)
268 |
269 |
270 | @callback(re.compile("imdb_back_button:(.*)"), owner=False)
271 | async def back_button_clicked(event):
272 | plot_id = event.data.decode().split(":", 1)[1]
273 | if not LIST.get(plot_id):
274 | return await event.answer("Query Expired! Search again 🔍")
275 | text = LIST[plot_id]["text"]
276 | buttons = LIST[plot_id]["buttons"]
277 | await event.edit(text, buttons=buttons)
278 |
279 |
280 | @callback(re.compile("extended_plot:(.*)"), owner=False)
281 | async def extended_plot_button_clicked(event):
282 | plot_id = event.data.decode().split(":", 1)[1]
283 | if not LIST.get(plot_id):
284 | return await event.answer("Query Expired! Search again 🔍")
285 | movie_name = LIST[plot_id]["movie_name"]
286 |
287 | ext_plot = await get_movie_data(movie_name, full_plot=True)
288 | fullplot = ext_plot.get("Plot", "")
289 |
290 | if fullplot:
291 | extended_plot = f"**Exᴛᴇɴᴅᴇᴅ Pʟᴏᴛ:** {fullplot}"
292 | btns = [
293 | [Button.inline("Back", data=f"imdb_back_button:{plot_id}")],
294 | ]
295 | await event.edit(extended_plot, buttons=btns)
296 |
--------------------------------------------------------------------------------
/inline/koo.py:
--------------------------------------------------------------------------------
1 |
2 | # Ultroid - UserBot
3 | # Copyright (C) 2021-2022 TeamUltroid
4 | #
5 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
6 | # PLease read the GNU Affero General Public License in
7 | # .
8 |
9 | from telethon.tl.types import InputWebDocument as wb
10 | from telethon.tl.custom import Button
11 | from . import in_pattern, InlinePlugin, async_searcher, asst
12 |
13 | __doc__ = f"""
14 | ✘ Commands Available -
15 | • `@{asst.username} koo `
16 | Searches for the query on Koo and returns the results.
17 | """
18 |
19 | _koo_ = {}
20 |
21 |
22 | @in_pattern("koo", owner=True)
23 | async def koo_search(ult):
24 | """Search Users on koo with API"""
25 | try:
26 | match = ult.text.split(maxsplit=1)[1].lower()
27 | match_ = match
28 | except IndexError:
29 | await ult.answer(
30 | [], switch_pm="Enter Query to Search..", switch_pm_param="start"
31 | )
32 | return
33 | if _koo_.get(match):
34 | return await ult.answer(
35 | _koo_[match], switch_pm="• Koo Search •", switch_pm_param="start"
36 | )
37 | res = []
38 | se_ = None
39 | key_count = None
40 | if " | " in match:
41 | match = match.split(" | ", maxsplit=1)
42 | try:
43 | key_count = int(match[1])
44 | except ValueError:
45 | pass
46 | match = match[0]
47 | match = match.replace(" ", "+")
48 | req = await async_searcher(
49 | f"https://www.kooapp.com/apiV1/search?query={match}&searchType=EXPLORE",
50 | re_json=True,
51 | )
52 | if key_count:
53 | try:
54 | se_ = [req["feed"][key_count - 1]]
55 | except KeyError:
56 | pass
57 | if not se_:
58 | se_ = req["feed"]
59 | for count, feed in enumerate(se_[:10]):
60 | if feed["uiItemType"] == "search_profile":
61 | count += 1
62 | item = feed["items"][0]
63 | profileImage = (
64 | item["profileImageBaseUrl"]
65 | if item.get("profileImageBaseUrl")
66 | else "https://telegra.ph/file/dc28e69bd7ea2c0f25329.jpg"
67 | )
68 | extra = await async_searcher(
69 | "https://www.kooapp.com/apiV1/users/handle/" + item["userHandle"],
70 | re_json=True,
71 | )
72 | img = wb(profileImage, 0, "image/jpeg", [])
73 | text = f"‣ **Name :** `{item['name']}`"
74 | if extra.get("title"):
75 | text += f"\n‣ **Title :** `{extra['title']}`"
76 | text += f"\n‣ **Username :** `@{item['userHandle']}`"
77 | if extra.get("description"):
78 | text += f"\n‣ **Description :** `{extra['description']}`"
79 | text += f"\n‣ **Followers :** `{extra['followerCount']}` ‣ **Following :** {extra['followingCount']}"
80 | if extra.get("socialProfile") and extra["socialProfile"].get("website"):
81 | text += f"\n‣ **Website :** {extra['socialProfile']['website']}"
82 | res.append(
83 | await ult.builder.article(
84 | title=item["name"],
85 | description=item.get("title") or f"@{item['userHandle']}",
86 | type="photo",
87 | content=img,
88 | thumb=img,
89 | include_media=True,
90 | text=text,
91 | buttons=[
92 | Button.url(
93 | "View",
94 | "https://kooapp.com/profile/" + item["userHandle"],
95 | ),
96 | Button.switch_inline(
97 | "• Share •",
98 | query=ult.text if key_count else f"{ult.text} | {count}",
99 | ),
100 | ],
101 | )
102 | )
103 |
104 | if not res:
105 | switch = "No Results Found :("
106 | else:
107 | _koo_.update({match_: res})
108 | switch = f"Showing {len(res)} Results!"
109 | await ult.answer(res, switch_pm=switch, switch_pm_param="start")
110 |
111 |
112 | InlinePlugin.update({"Kᴏᴏ Sᴇᴀʀᴄʜ": "koo @__kumar__amit"})
113 |
--------------------------------------------------------------------------------
/inline/npmsearch.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | from telethon.tl.types import InputWebDocument as wb
9 | from telethon.tl.custom import Button
10 | from . import in_pattern, InlinePlugin, async_searcher, asst
11 |
12 | __doc__ = f"""
13 | ✘ Commands Available -
14 | • `@{asst.username} npm `
15 | Searches for the package on NPM and returns the results.
16 | """
17 |
18 |
19 | @in_pattern("npm")
20 | async def search_npm(event):
21 | try:
22 | query = event.text.split(maxsplit=1)[1]
23 | except IndexError:
24 | await event.answer([], switch_pm="Enter query to search", switch_pm_param="start"
25 | )
26 | return
27 | data = await async_searcher(f"https://registry.npmjs.com/-/v1/search?text={query.replace(' ','+')}&size=7", re_json=True)
28 | res = []
29 | for obj in data["objects"]:
30 | package = obj["package"]
31 | url = package["links"]["npm"]
32 | title = package["name"]
33 | keys = package.get("keywords", [])
34 | text = f"**[{title}]({package['links'].get('homepage', '')})\n{package['description']}**\n"
35 | text += f"**Version:** `{package['version']}`\n"
36 | text += f"**Keywords:** `{','.join(keys)}`"
37 | res.append(await event.builder.article(
38 | title=title,
39 | text=text,
40 | url=url,
41 | link_preview=False,
42 | buttons=[
43 | Button.url("View", url),
44 | Button.switch_inline("Search again", query=event.text, same_peer=True),
45 | ],
46 | ))
47 | await event.answer(res, switch_pm="NPM Search", switch_pm_param="start")
48 |
49 | InlinePlugin.update({"Npm Search": "npm"})
50 |
--------------------------------------------------------------------------------
/inline/omgubuntu.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 |
9 | from telethon.tl.custom import Button
10 | from telethon.tl.types import InputWebDocument as wb
11 | from .. import async_searcher, in_pattern, InlinePlugin, asst
12 | from bs4 import BeautifulSoup as bs
13 |
14 | __doc__ = f"""
15 | ✘ Commands Available -
16 | • `@{asst.username} omgu `
17 | Searches for the query on OMG Ubuntu and returns the results.
18 | """
19 |
20 | _OMG = {}
21 |
22 | @in_pattern("omgu", owner=True)
23 | async def omgubuntu(ult):
24 | try:
25 | match = ult.text.split(maxsplit=1)[1].lower()
26 | except IndexError:
27 | await ult.answer(
28 | [], switch_pm="Enter Query to search...", switch_pm_param="start"
29 | )
30 | return
31 | if _OMG.get(match):
32 | return await ult.answer(
33 | _OMG[match], switch_pm="OMG Ubuntu Search :]", switch_pm_param="start"
34 | )
35 | get_web = "https://www.omgubuntu.co.uk/?s=" + match.replace(" ", "+")
36 | get_ = await async_searcher(get_web, re_content=True)
37 | BSC = bs(get_, "html.parser", from_encoding="utf-8")
38 | res = []
39 | for cont in BSC.find_all("div", "sbs-layout__item"):
40 | img = cont.find("div", "sbs-layout__image")
41 | url = img.find("a")["href"]
42 | src = img.find("img")["src"]
43 | con = cont.find("div", "sbs-layout__content")
44 | tit = con.find("a", "layout__title-link")
45 | title = tit.text.strip()
46 | desc = con.find("p", "layout__description").text.strip()
47 | text = f"[{title.strip()}]({url})\n\n{desc}"
48 | img = wb(src, 0, "image/jpeg", [])
49 | res.append(
50 | await ult.builder.article(
51 | title=title,
52 | type="photo",
53 | description=desc,
54 | url=url,
55 | text=text,
56 | buttons=Button.switch_inline(
57 | "Search Again", query=ult.text, same_peer=True
58 | ),
59 | include_media=True,
60 | content=img,
61 | thumb=img,
62 | )
63 | )
64 | await ult.answer(
65 | res,
66 | switch_pm=f"Showing {len(res)} results!" if res else "No Results Found :[",
67 | switch_pm_param="start",
68 | )
69 | _OMG[match] = res
70 |
71 |
72 | InlinePlugin.update({"OᴍɢUʙᴜɴᴛᴜ": "omgu cutefish"})
73 |
--------------------------------------------------------------------------------
/inline/pypi.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2024 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 | from . import *
8 | import hashlib
9 | import inspect
10 | import os
11 | import re
12 | from datetime import datetime
13 | from html import unescape
14 | from random import choice
15 | from re import compile as re_compile
16 | from bs4 import BeautifulSoup as bs
17 |
18 | try:
19 | from markdownify import markdownify as md
20 | except ImportError:
21 | os.system("pip3 install -q markdownify")
22 | from markdownify import markdownify as md
23 |
24 | from telethon import Button
25 | from telethon.tl.alltlobjects import LAYER, tlobjects
26 | from telethon.tl.types import DocumentAttributeAudio as Audio
27 | from telethon.tl.types import InputWebDocument as wb
28 | from telethon.tl.types import MessageEntityTextUrl
29 |
30 | __doc__ = f"""
31 | ✘ Commands Available -
32 | • `@{asst.username} pypi `
33 | Searches for the package on PyPI and returns the results.
34 | """
35 |
36 | hash_to_url = {}
37 |
38 |
39 | def generate_unique_id(url):
40 | hashed_id = hashlib.sha256(url.encode()).hexdigest()[:8]
41 | hash_to_url[hashed_id] = url
42 | return hashed_id
43 |
44 |
45 | def get_original_url(hashed_id):
46 | return hash_to_url.get(hashed_id)
47 |
48 |
49 | def clean_desc(description):
50 | # Remove lines starting with ".."
51 | description = re.sub(r"^\.\.", "", description, flags=re.MULTILINE)
52 | # Remove lines starting with "|"
53 | description = re.sub(r"^\|", "", description, flags=re.MULTILINE)
54 | # Remove lines starting with ":"
55 | description = re.sub(r"^:", "", description, flags=re.MULTILINE)
56 | # Remove lines starting with " :"
57 | description = re.sub(r"^ {2}:", "", description, flags=re.MULTILINE)
58 | # Remove lines starting with "/3/"
59 | description = re.sub(r"/\d+/", "", description)
60 | # Remove lines starting with "code-block:: python"
61 | description = re.sub(
62 | r"^\s*code-block::.*$", "", description, flags=re.IGNORECASE | re.MULTILINE
63 | )
64 | # Remove any remaining leading or trailing whitespace
65 | description = description.strip()
66 | return description
67 |
68 |
69 | PYPI_LIST = {}
70 |
71 |
72 | @in_pattern("pypi")
73 | async def inline_pypi_handler(event):
74 | pypimg = "https://graph.org/file/004c65a44efa1efc85193.jpg"
75 | BASE_URL = "https://pypi.org/pypi/{}/json"
76 | try:
77 | package = event.text.split(" ", maxsplit=1)[1]
78 | except IndexError:
79 | await event.answer(
80 | [
81 | event.builder.article(
82 | type="photo",
83 | include_media=True,
84 | title="sᴇᴀʀᴄʜ ᴘʏᴘɪ",
85 | thumb=wb(pypimg, 0, "image/jpeg", []),
86 | content=wb(pypimg, 0, "image/jpeg", []),
87 | text=f"**ᴘʏᴘɪ sᴇᴀʀᴄʜ**\n\nʏᴏᴜ ᴅɪᴅɴ'ᴛ sᴇᴀʀᴄʜ ғᴏʀ ᴀɴʏᴛʜɪɴɢ.",
88 | buttons=[
89 | Button.switch_inline(
90 | "sᴇᴀʀᴄʜ ᴀɢᴀɪɴ",
91 | query="pypi ",
92 | same_peer=True,
93 | ),
94 | ],
95 | )
96 | ]
97 | )
98 | return
99 |
100 | response = await async_searcher(BASE_URL.format(package), re_json=True)
101 | if response is not None and "info" in response:
102 | info = response["info"]
103 | name = info["name"]
104 | url = info["package_url"]
105 | version = info["version"]
106 | summary = info["summary"]
107 | qid = generate_unique_id(name)
108 | txt = f"**ᴘᴀᴄᴋᴀɢᴇ:** [{name}]({url}) (`{version}`)\n\n**ᴅᴇᴛᴀɪʟs:** `{summary}`"
109 |
110 | offset = txt.find(name)
111 | length = len(name)
112 | url_entity = MessageEntityTextUrl(offset=offset, length=length, url=url)
113 |
114 | # Extract document links from description
115 | document_links = re.findall(r"(https?://\S+)", info["description"])
116 |
117 | buttons = [
118 | Button.inline("sʜᴏᴡ ᴅᴇᴛᴀɪʟs", data=f"pypi_details:{qid}"),
119 | Button.inline("ᴅᴏᴄᴜᴍᴇɴᴛ ʟɪɴᴋs", data=f"pypi_documents:{qid}"),
120 | ]
121 |
122 | await event.answer(
123 | [
124 | event.builder.article(
125 | type="photo",
126 | include_media=True,
127 | title="ᴘᴀᴄᴋᴀɢᴇ ɪɴғᴏ",
128 | thumb=wb(
129 | "https://graph.org/file/f09380ada91534b2f6687.jpg",
130 | 0,
131 | "image/jpeg",
132 | [],
133 | ),
134 | content=wb(
135 | "https://graph.org/file/f09380ada91534b2f6687.jpg",
136 | 0,
137 | "image/jpeg",
138 | [],
139 | ),
140 | description=f"{name}\n{version}",
141 | text=txt,
142 | buttons=buttons,
143 | )
144 | ]
145 | )
146 |
147 | PYPI_LIST.update(
148 | {
149 | qid: {
150 | "info": info,
151 | "name": name,
152 | "url": url,
153 | "version": version,
154 | "summary": summary,
155 | "text": txt,
156 | "document_links": document_links,
157 | "buttons": buttons,
158 | }
159 | }
160 | )
161 | else:
162 | await event.answer(
163 | [
164 | event.builder.article(
165 | title="ᴘᴀᴄᴋᴀɢᴇ ɴᴏᴛ ғᴏᴜɴᴅ",
166 | thumb=wb(pypimg, 0, "image/jpeg", []),
167 | text=f"**ᴘᴀᴄᴋᴀɢᴇ:** `{package}`\n\n**ᴅᴇᴛᴀɪʟs:** `ɴᴏᴛ ғᴏᴜɴᴅ`",
168 | )
169 | ]
170 | )
171 | return
172 |
173 |
174 | @callback(re.compile("pypi_details:(.*)"), owner=False)
175 | async def show_details(event):
176 | qid = event.data.decode().split(":", 1)[1]
177 | if not PYPI_LIST.get(qid):
178 | return await event.answer("Qᴜᴇʀʏ ᴇxᴘɪʀᴇᴅ! Sᴇᴀʀᴄʜ ᴀɢᴀɪɴ 🔍")
179 | info = PYPI_LIST[qid]
180 | details = info["info"]
181 |
182 | author = details.get("author", "Uɴᴋɴᴏᴡɴ")
183 | author_email = details.get("author_email", "Uɴᴋɴᴏᴡɴ")
184 | classifiers = "\n".join(details.get("classifiers", []))
185 | description = details.get("description", "N/A")
186 |
187 | formatted_description = md(description)
188 | clean_description = re.sub(r"\*\*|`|\\|_", "", formatted_description)
189 | clean_description = clean_desc(clean_description)
190 | PYPI_LIST[qid]["description"] = clean_description
191 |
192 | text = f"**ᴀᴜᴛʜᴏʀ:** {author}\n"
193 | text += f"**ᴀᴜᴛʜᴏʀ ᴇᴍᴀɪʟ:** {author_email}\n"
194 | text += f"**ᴄʟᴀssɪғɪᴇʀs:**\n{classifiers}\n"
195 |
196 | if description == "N/A":
197 | buttons = [
198 | Button.inline("ʙᴀᴄᴋ", data=f"pypi_back_button:{qid}"),
199 | ]
200 | await event.edit(text, buttons=buttons)
201 | else:
202 | buttons = [
203 | Button.inline("ᴍᴏʀᴇ", data=f"pypi_description_more:{qid}"),
204 | Button.inline("ʙᴀᴄᴋ", data=f"pypi_back_button:{qid}"),
205 | ]
206 | await event.edit(text, buttons=buttons)
207 |
208 |
209 | @callback(re.compile("pypi_documents:(.*)"), owner=True)
210 | async def show_documents(event):
211 | qid = event.data.decode().split(":", 1)[1]
212 | if not PYPI_LIST.get(qid):
213 | return await event.answer("Qᴜᴇʀʏ ᴇxᴘɪʀᴇᴅ! Sᴇᴀʀᴄʜ ᴀɢᴀɪɴ 🔍")
214 | document_links = PYPI_LIST[qid]["document_links"]
215 | if document_links:
216 | text = "**ᴅᴏᴄ ʟɪɴᴋs**\n╭────────────────•\n"
217 | text += "\n".join(
218 | [
219 | f"╰➢ [{link.split('//')[1].split('/')[0]}]({link})"
220 | for link in document_links
221 | ]
222 | )
223 | text += "\n╰────────────────•"
224 | buttons = [
225 | Button.inline("ʙᴀᴄᴋ", data=f"pypi_back_button:{qid}"),
226 | ]
227 | await event.edit(text, buttons=buttons)
228 | else:
229 | await event.answer("ɴᴏ ᴅᴏᴄᴜᴍᴇɴᴛ ʟɪɴᴋs ғᴏᴜɴᴅ.")
230 |
231 |
232 | @callback(re.compile("pypi_description_more:(.*)"), owner=True)
233 | async def show_full_description(event):
234 | qid = event.data.decode().split(":", 1)[1]
235 | description = PYPI_LIST[qid].get("description")
236 | if description:
237 | already_defined_text_length = len("ᴅᴇsᴄʀɪᴘᴛɪᴏɴ:\nPage X/Y\n")
238 | current_page = 1
239 | await show_description_with_pagination(
240 | event, qid, description, already_defined_text_length, current_page
241 | )
242 |
243 |
244 | async def show_description_with_pagination(
245 | event, qid, description, already_defined_text_length, current_page
246 | ):
247 | available_length = 1024 - already_defined_text_length
248 |
249 | description_chunks = [
250 | description[i : i + available_length]
251 | for i in range(0, len(description), available_length)
252 | ]
253 | total_chunks = len(description_chunks)
254 |
255 | text = f"**ᴅᴇsᴄʀɪᴘᴛɪᴏɴ:**\n**Pᴀɢᴇ** `{current_page}`/`{total_chunks}`\n{description_chunks[current_page - 1]}"
256 | buttons = [
257 | Button.inline("<<", data=f"pypi_description_page:{qid}:{current_page-1}"),
258 | Button.inline("ʙᴀᴄᴋ", data=f"pypi_back_button:{qid}"),
259 | Button.inline(">>", data=f"pypi_description_page:{qid}:{current_page+1}"),
260 | ]
261 | await event.edit(text, buttons=buttons)
262 |
263 |
264 | @callback(re.compile("pypi_description_page:(.*):(\\d+)"), owner=True)
265 | async def handle_description_page(event):
266 | qid, page = event.data.decode().split(":")[1:]
267 | description = PYPI_LIST[qid].get("description")
268 | if description:
269 | already_defined_text_length = len("ᴅᴇsᴄʀɪᴘᴛɪᴏɴ:\nPage X/Y\n")
270 | page_number = int(page)
271 | await show_description_with_pagination(
272 | event,
273 | qid,
274 | description,
275 | already_defined_text_length,
276 | current_page=page_number,
277 | )
278 |
279 |
280 | @callback(re.compile("pypi_back_button:(.*)"), owner=True)
281 | async def back_button_clicked(event):
282 | qid = event.data.decode().split(":", 1)[1]
283 | if not PYPI_LIST.get(qid):
284 | return await event.answer("Qᴜᴇʀʏ ᴇxᴘɪʀᴇᴅ! Sᴇᴀʀᴄʜ ᴀɢᴀɪɴ 🔍")
285 | text = PYPI_LIST[qid]["text"]
286 | buttons = PYPI_LIST[qid]["buttons"]
287 | await event.edit(text, buttons=buttons)
288 |
--------------------------------------------------------------------------------
/inline/winget.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | #
7 |
8 | import re
9 | from telethon.tl.types import InputWebDocument as wb
10 | from . import get_string, async_searcher, in_pattern, InlinePlugin, async_searcher, asst
11 |
12 | __doc__ = f"""
13 | ✘ Commands Available -
14 | • `@{asst.username} winget `
15 | Searches for the query on Winget and returns the results.
16 | """
17 | from telethon.tl.custom import Button
18 |
19 | @in_pattern("winget", owner=True)
20 | async def search_winget(event):
21 | QUERY = event.text.split(maxsplit=1)
22 | try:
23 | query = QUERY[1]
24 | except IndexError:
25 | await event.answer(
26 | [], switch_pm=get_string("instu_3"), switch_pm_param="start"
27 | )
28 | return
29 | le = "https://api.winget.run/v2/packages?ensureContains=true&partialMatch=true&take=20&query=" + query.replace(" ", "+")
30 | ct = await async_searcher(le, re_json=True)
31 | out = []
32 | for on in ct["Packages"]:
33 | data = on["Latest"]
34 | name = data["Name"]
35 | homep = data.get("Homepage")
36 | text = f"> **{name}**\n - {data['Description']}\n\n`winget install {on['Id']}`\n\n**Version:** `{on['Versions'][0]}`\n"
37 | text += "**Tags:**" + " ".join([f"#{_}" for _ in data["Tags"]])
38 | if homep:
39 | text += f"\n\n{homep}"
40 | out.append(
41 | await event.builder.article(
42 | title=name, description=data["Description"], url=homep, text=text, buttons=Button.switch_inline("Search Again", "winget", same_peer=True)
43 | )
44 | )
45 | uppar = "|> Winget Results" if out else "No Results Found :("
46 | await event.answer(out, switch_pm=uppar, switch_pm_param="start", cache_time=3000)
47 |
48 |
49 | InlinePlugin.update({"Search Winget": "winget telegram"})
50 |
--------------------------------------------------------------------------------
/inline/xdasearch.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | #
7 |
8 | import re
9 | from bs4 import BeautifulSoup as bs
10 | from telethon.tl.types import InputWebDocument as wb
11 | from . import get_string, async_searcher, in_pattern, InlinePlugin, asst
12 |
13 | __doc__ = f"""
14 | ✘ Commands Available -
15 |
16 | • `@{asst.username} xda `
17 | Searches for the query on XDA Developers and returns the results.
18 | """
19 |
20 | # Inspired by @FindXDaBot
21 |
22 | @in_pattern("xda", owner=True)
23 | async def xda_dev(event):
24 | QUERY = event.text.split(maxsplit=1)
25 | try:
26 | query = QUERY[1]
27 | except IndexError:
28 | await event.answer(
29 | [], switch_pm=get_string("instu_3"), switch_pm_param="start"
30 | )
31 | return
32 | le = "https://www.xda-developers.com/search/?q=" + query.replace(" ", "+")
33 | ct = await async_searcher(le, re_content=True)
34 | ml = bs(ct, "html.parser", from_encoding="utf-8")
35 | cards = ml.find_all("div", class_="display-card")
36 | out = []
37 | for card in cards:
38 | # Title and URL
39 | title_tag = card.find("h5", class_="display-card-title")
40 | a_tag = title_tag.find("a") if title_tag else None
41 | title = a_tag.get("title") or a_tag.text.strip() if a_tag else "No Title"
42 | href = a_tag.get("href") if a_tag else ""
43 | if href and href.startswith("/"):
44 | href = "https://www.xda-developers.com" + href
45 |
46 | # Description
47 | desc_tag = card.find("p", class_="display-card-excerpt")
48 | desc = desc_tag.text.strip() if desc_tag else ""
49 |
50 | # Thumbnail
51 | img_tag = card.find("img")
52 | thumb = img_tag.get("data-img-url") or img_tag.get("src") if img_tag else None
53 | if thumb:
54 | thumb = wb(thumb, 0, "image/jpeg", [])
55 |
56 | text = f"[{title}]({href})"
57 | out.append(
58 | await event.builder.article(
59 | title=title, description=desc, url=href, thumb=thumb, text=text
60 | )
61 | )
62 | uppar = "|| XDA Search Results ||" if out else "No Results Found :("
63 | await event.answer(out, switch_pm=uppar, switch_pm_param="start")
64 |
65 |
66 | InlinePlugin.update({"Search on XDA": "xda telegram"})
--------------------------------------------------------------------------------
/inlinefun.py:
--------------------------------------------------------------------------------
1 | #
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 | # .tweet made for ultroid
8 |
9 | # .uta ported from Dark-Cobra
10 |
11 | """
12 | ✘ Commands Available -
13 |
14 | • `{i}uta `
15 | Inline song search and downloader.
16 |
17 | • `{i}gglax `
18 | Create google search sticker with text.
19 |
20 | • `{i}stic `
21 | Get random stickers from emoji.
22 |
23 | • `{i}frog `
24 | make text stickers.
25 |
26 | • `{i}tweet `
27 | make twitter posts.
28 |
29 | • `{i}quot `
30 | write quote on animated sticker.
31 | """
32 |
33 | from random import choice
34 |
35 | from addons.waifu import deEmojify
36 |
37 | from . import ultroid_cmd, get_string
38 |
39 |
40 | @ultroid_cmd(pattern="tweet ?(.*)")
41 | async def tweet(e):
42 | wai = await e.eor()
43 | text = e.pattern_match.group(1)
44 | if not text:
45 | return await wai.edit("`Give me Some Text !`")
46 | try:
47 | results = await e.client.inline_query("twitterstatusbot", text)
48 | await e.reply("New Tweet", file=results[0].document)
49 | await wai.delete()
50 | except Exception as m:
51 | await e.eor(str(m))
52 |
53 |
54 | @ultroid_cmd(pattern="stic ?(.*)")
55 | async def tweet(e):
56 | if len(e.text) > 5 and e.text[5] != " ":
57 | return
58 | wai = await e.eor(get_string("com_1"))
59 | text = e.pattern_match.group(1)
60 | if not text:
61 | return await wai.edit("`Give me Some Emoji !`")
62 | results = await e.client.inline_query("sticker", text)
63 | num = choice(results)
64 | await e.reply("@sticker", file=num.document)
65 | await wai.delete()
66 |
67 |
68 | @ultroid_cmd(pattern="gglax ?(.*)")
69 | async def gglax_sticker(e):
70 | wai = await e.eor(get_string("com_1"))
71 | text = e.pattern_match.group(1)
72 | if not text:
73 | return await wai.edit("`Give me Some Text !`")
74 | try:
75 | results = await e.client.inline_query("googlaxbot", text)
76 | await e.reply("Googlax", file=results[0].document)
77 | await wai.delete()
78 | except Exception as m:
79 | await e.eor(str(m))
80 |
81 |
82 | @ultroid_cmd(pattern="frog ?(.*)")
83 | async def honkasays(e):
84 | wai = await e.eor(get_string("com_1"))
85 | text = e.pattern_match.group(1)
86 | if not text:
87 | return await wai.edit("`Give Me Some Text !`")
88 | text = deEmojify(text)
89 | if not text.endswith("."):
90 | text += "."
91 | if len(text) <= 9:
92 | q = 2
93 | elif len(text) >= 14:
94 | q = 0
95 | else:
96 | q = 1
97 | try:
98 | res = await e.client.inline_query("honka_says_bot", text)
99 | await e.reply("Honka", file=res[q].document)
100 | await wai.delete()
101 | except Exception as er:
102 | await wai.edit(str(er))
103 |
104 |
105 | @ultroid_cmd(pattern="uta ?(.*)")
106 | async def nope(doit):
107 | ok = doit.pattern_match.group(1)
108 | replied = await doit.get_reply_message()
109 | a = await doit.eor(get_string("com_1"))
110 | if ok:
111 | pass
112 | elif replied and replied.message:
113 | ok = replied.message
114 | else:
115 | return await doit.eor(
116 | "`Sir please give some query to search and download it for you..!`",
117 | )
118 | sticcers = await doit.client.inline_query("Lybot", f"{(deEmojify(ok))}")
119 | await doit.reply(file=sticcers[0].document)
120 | await a.delete()
121 |
122 |
123 | @ultroid_cmd(pattern="quot ?(.*)")
124 | async def quote_(event):
125 | IFUZI = event.pattern_match.group(1)
126 | if "quotly" in event.text:
127 | return
128 | if not IFUZI:
129 | return await event.eor("`Give some text to make Quote..`")
130 | EI_IR = await event.eor(get_string("com_1"))
131 | try:
132 | RE_ZK = await event.client.inline_query("@QuotAfBot", IFUZI)
133 | await event.reply(file=choice(RE_ZK).document)
134 | except Exception as U_TG:
135 | return await EI_IR.edit(str(U_TG))
136 | await EI_IR.delete()
137 |
--------------------------------------------------------------------------------
/limited.py:
--------------------------------------------------------------------------------
1 | # inspired from bin.py which was made by @danish_00
2 | # written by @senku_ishigamiii/@Uzumaki_Naruto_XD
3 |
4 | """
5 | ✘ Commands Available -
6 |
7 | • `{i}limited`
8 | Check you are limited or not !
9 | """
10 |
11 | from telethon import events
12 | from telethon.errors.rpcerrorlist import YouBlockedUserError
13 |
14 | from . import ultroid_cmd
15 |
16 |
17 | @ultroid_cmd(pattern="limited$")
18 | async def demn(ult):
19 | chat = "@SpamBot"
20 | msg = await ult.eor("Checking If You Are Limited...")
21 | async with ult.client.conversation(chat) as conv:
22 | try:
23 | response = conv.wait_event(
24 | events.NewMessage(incoming=True, from_users=178220800)
25 | )
26 | await conv.send_message("/start")
27 | response = await response
28 | await ult.client.send_read_acknowledge(chat)
29 | except YouBlockedUserError:
30 | await msg.edit("Boss! Please Unblock @SpamBot ")
31 | return
32 | await msg.edit(f"~ {response.message.message}")
33 |
--------------------------------------------------------------------------------
/memify.py:
--------------------------------------------------------------------------------
1 | # Ported Nd Modified For Ultroid
2 | # Ported From DarkCobra (Modified by @ProgrammingError)
3 | #
4 | # Ultroid - UserBot
5 | # Copyright (C) 2020 TeamUltroid
6 | #
7 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
8 | # PLease read the GNU Affero General Public License in
9 | # .
10 |
11 | """
12 | ✘ Commands Available -
13 |
14 | • `{i}mmf ; `
15 | To create memes as sticker,
16 | for trying different fonts use (.mmf _1)(u can use 1 to 10).
17 |
18 | • `{i}mms ; `
19 | To create memes as pic,
20 | for trying different fonts use (.mms _1)(u can use 1 to 10).
21 |
22 | """
23 |
24 | import asyncio
25 | import os
26 | import textwrap
27 |
28 | import cv2
29 | from PIL import Image, ImageDraw, ImageFont
30 |
31 | from . import *
32 |
33 |
34 | @ultroid_cmd(pattern="mmf ?(.*)")
35 | async def ultd(event):
36 | ureply = await event.get_reply_message()
37 | msg = event.pattern_match.group(1)
38 | if not (ureply and (ureply.media)):
39 | xx = await event.eor("`Reply to any media`")
40 | return
41 | if not msg:
42 | xx = await event.eor("`Give me something text to write...`")
43 | return
44 | ultt = await ureply.download_media()
45 | if ultt.endswith((".tgs")):
46 | xx = await event.eor("`Ooo Animated Sticker 👀...`")
47 | cmd = ["lottie_convert.py", ultt, "ult.png"]
48 | file = "ult.png"
49 | process = await asyncio.create_subprocess_exec(
50 | *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
51 | )
52 | stdout, stderr = await process.communicate()
53 | stderr.decode().strip()
54 | stdout.decode().strip()
55 | elif ultt.endswith((".webp", ".png")):
56 | xx = await event.eor("`Processing`")
57 | im = Image.open(ultt)
58 | im.save("ult.png", format="PNG", optimize=True)
59 | file = "ult.png"
60 | else:
61 | xx = await event.eor("`Processing`")
62 | img = cv2.VideoCapture(ultt)
63 | heh, lol = img.read()
64 | cv2.imwrite("ult.png", lol)
65 | file = "ult.png"
66 | stick = await draw_meme_text(file, msg)
67 | await event.client.send_file(
68 | event.chat_id, stick, force_document=False, reply_to=event.reply_to_msg_id
69 | )
70 | await xx.delete()
71 | try:
72 | os.remove(ultt)
73 | os.remove(file)
74 | os.remove(stick)
75 | except BaseException:
76 | pass
77 |
78 |
79 | async def draw_meme_text(image_path, msg):
80 | img = Image.open(image_path)
81 | os.remove(image_path)
82 | i_width, i_height = img.size
83 | if "_" in msg:
84 | text, font = msg.split("_")
85 | else:
86 | text = msg
87 | font = "default"
88 | if ";" in text:
89 | upper_text, lower_text = text.split(";")
90 | else:
91 | upper_text = text
92 | lower_text = ""
93 | draw = ImageDraw.Draw(img)
94 | m_font = ImageFont.truetype(
95 | f"resources/fonts/{font}.ttf", int((70 / 640) * i_width)
96 | )
97 | current_h, pad = 10, 5
98 | if upper_text:
99 | for u_text in textwrap.wrap(upper_text, width=15):
100 | bbox = draw.textbbox((0, 0), u_text, font=m_font)
101 | u_width, u_height = bbox[2] - bbox[0], bbox[3] - bbox[1]
102 | draw.text(
103 | xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)),
104 | text=u_text,
105 | font=m_font,
106 | fill=(0, 0, 0),
107 | )
108 | draw.text(
109 | xy=(((i_width - u_width) / 2) + 1, int((current_h / 640) * i_width)),
110 | text=u_text,
111 | font=m_font,
112 | fill=(0, 0, 0),
113 | )
114 | draw.text(
115 | xy=((i_width - u_width) / 2, int(((current_h / 640) * i_width)) - 1),
116 | text=u_text,
117 | font=m_font,
118 | fill=(0, 0, 0),
119 | )
120 | draw.text(
121 | xy=(((i_width - u_width) / 2), int(((current_h / 640) * i_width)) + 1),
122 | text=u_text,
123 | font=m_font,
124 | fill=(0, 0, 0),
125 | )
126 | draw.text(
127 | xy=((i_width - u_width) / 2, int((current_h / 640) * i_width)),
128 | text=u_text,
129 | font=m_font,
130 | fill=(255, 255, 255),
131 | )
132 | current_h += u_height + pad
133 | if lower_text:
134 | for l_text in textwrap.wrap(lower_text, width=15):
135 | bbox = draw.textbbox((0, 0), l_text, font=m_font)
136 | u_width, u_height = bbox[2] - bbox[0], bbox[3] - bbox[1]
137 | draw.text(
138 | xy=(
139 | ((i_width - u_width) / 2) - 1,
140 | i_height - u_height - int((80 / 640) * i_width),
141 | ),
142 | text=l_text,
143 | font=m_font,
144 | fill=(0, 0, 0),
145 | )
146 | draw.text(
147 | xy=(
148 | ((i_width - u_width) / 2) + 1,
149 | i_height - u_height - int((80 / 640) * i_width),
150 | ),
151 | text=l_text,
152 | font=m_font,
153 | fill=(0, 0, 0),
154 | )
155 | draw.text(
156 | xy=(
157 | (i_width - u_width) / 2,
158 | (i_height - u_height - int((80 / 640) * i_width)) - 1,
159 | ),
160 | text=l_text,
161 | font=m_font,
162 | fill=(0, 0, 0),
163 | )
164 | draw.text(
165 | xy=(
166 | (i_width - u_width) / 2,
167 | (i_height - u_height - int((80 / 640) * i_width)) + 1,
168 | ),
169 | text=l_text,
170 | font=m_font,
171 | fill=(0, 0, 0),
172 | )
173 | draw.text(
174 | xy=(
175 | (i_width - u_width) / 2,
176 | i_height - u_height - int((80 / 640) * i_width),
177 | ),
178 | text=l_text,
179 | font=m_font,
180 | fill=(255, 255, 255),
181 | )
182 | current_h += u_height + pad
183 | imag = "ultt.webp"
184 | img.save(imag, "WebP")
185 | return imag
186 |
187 |
188 | @ultroid_cmd(pattern="mms ?(.*)")
189 | async def mms(event):
190 | ureply = await event.get_reply_message()
191 | msg = event.pattern_match.group(1)
192 | if not (ureply and (ureply.media)):
193 | xx = await event.eor("`Reply to any media`")
194 | return
195 | if not msg:
196 | xx = await event.eor("`Give me something text to write 😑`")
197 | return
198 | ultt = await ureply.download_media()
199 | if ultt.endswith((".tgs")):
200 | xx = await event.eor("`Ooo Animated Sticker 👀...`")
201 | cmd = ["lottie_convert.py", ultt, "ult.png"]
202 | file = "ult.png"
203 | process = await asyncio.create_subprocess_exec(
204 | *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
205 | )
206 | stdout, stderr = await process.communicate()
207 | stderr.decode().strip()
208 | stdout.decode().strip()
209 | elif ultt.endswith((".webp", ".png")):
210 | xx = await event.eor("`Processing`")
211 | im = Image.open(ultt)
212 | im.save("ult.png", format="PNG", optimize=True)
213 | file = "ult.png"
214 | else:
215 | xx = await event.eor("`Processing`")
216 | img = cv2.VideoCapture(ultt)
217 | heh, lol = img.read()
218 | cv2.imwrite("ult.png", lol)
219 | file = "ult.png"
220 | pic = await draw_meme(file, msg)
221 | await event.client.send_file(
222 | event.chat_id, pic, force_document=False, reply_to=event.reply_to_msg_id
223 | )
224 | await xx.delete()
225 | try:
226 | os.remove(ultt)
227 | os.remove(file)
228 | except BaseException:
229 | pass
230 | os.remove(pic)
231 |
232 |
233 | async def draw_meme(image_path, msg):
234 | img = Image.open(image_path)
235 | os.remove(image_path)
236 | i_width, i_height = img.size
237 | if "_" in msg:
238 | text, font = msg.split("_")
239 | else:
240 | text = msg
241 | font = "default"
242 | if ";" in text:
243 | upper_text, lower_text = text.split(";")
244 | else:
245 | upper_text = text
246 | lower_text = ""
247 | draw = ImageDraw.Draw(img)
248 | m_font = ImageFont.truetype(
249 | f"resources/fonts/{font}.ttf", int((70 / 640) * i_width)
250 | )
251 | current_h, pad = 10, 5
252 | if upper_text:
253 | for u_text in textwrap.wrap(upper_text, width=15):
254 | bbox = draw.textbbox((0, 0), u_text, font=m_font)
255 | u_width, u_height = bbox[2] - bbox[0], bbox[3] - bbox[1]
256 | draw.text(
257 | xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)),
258 | text=u_text,
259 | font=m_font,
260 | fill=(0, 0, 0),
261 | )
262 | draw.text(
263 | xy=(((i_width - u_width) / 2) + 1, int((current_h / 640) * i_width)),
264 | text=u_text,
265 | font=m_font,
266 | fill=(0, 0, 0),
267 | )
268 | draw.text(
269 | xy=((i_width - u_width) / 2, int(((current_h / 640) * i_width)) - 1),
270 | text=u_text,
271 | font=m_font,
272 | fill=(0, 0, 0),
273 | )
274 | draw.text(
275 | xy=(((i_width - u_width) / 2), int(((current_h / 640) * i_width)) + 1),
276 | text=u_text,
277 | font=m_font,
278 | fill=(0, 0, 0),
279 | )
280 | draw.text(
281 | xy=((i_width - u_width) / 2, int((current_h / 640) * i_width)),
282 | text=u_text,
283 | font=m_font,
284 | fill=(255, 255, 255),
285 | )
286 | current_h += u_height + pad
287 | if lower_text:
288 | for l_text in textwrap.wrap(lower_text, width=15):
289 | bbox = draw.textbbox((0, 0), l_text, font=m_font)
290 | u_width, u_height = bbox[2] - bbox[0], bbox[3] - bbox[1]
291 | draw.text(
292 | xy=(
293 | ((i_width - u_width) / 2) - 1,
294 | i_height - u_height - int((20 / 640) * i_width),
295 | ),
296 | text=l_text,
297 | font=m_font,
298 | fill=(0, 0, 0),
299 | )
300 | draw.text(
301 | xy=(
302 | ((i_width - u_width) / 2) + 1,
303 | i_height - u_height - int((20 / 640) * i_width),
304 | ),
305 | text=l_text,
306 | font=m_font,
307 | fill=(0, 0, 0),
308 | )
309 | draw.text(
310 | xy=(
311 | (i_width - u_width) / 2,
312 | (i_height - u_height - int((20 / 640) * i_width)) - 1,
313 | ),
314 | text=l_text,
315 | font=m_font,
316 | fill=(0, 0, 0),
317 | )
318 | draw.text(
319 | xy=(
320 | (i_width - u_width) / 2,
321 | (i_height - u_height - int((20 / 640) * i_width)) + 1,
322 | ),
323 | text=l_text,
324 | font=m_font,
325 | fill=(0, 0, 0),
326 | )
327 | draw.text(
328 | xy=(
329 | (i_width - u_width) / 2,
330 | i_height - u_height - int((20 / 640) * i_width),
331 | ),
332 | text=l_text,
333 | font=m_font,
334 | fill=(255, 255, 255),
335 | )
336 | current_h += u_height + pad
337 | pics = "ultt.png"
338 | img.save(pics, "png")
339 | return pics
--------------------------------------------------------------------------------
/morsecode.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | #
3 | # This file is a part of < https://github.com/TeamUltroid/UltroidAddons/ >
4 | # PLease read the GNU Affero General Public License in
5 | # .
6 |
7 | """
8 | ✘ Commands Available -
9 |
10 | • `{i}mencode `
11 | Encode the given text to Morse Code.
12 |
13 | • `{i}mdecode `
14 | Decode the given text from Morse Code.
15 | """
16 |
17 | from . import async_searcher, ultroid_cmd, get_string
18 |
19 | @ultroid_cmd(pattern="mencode ?(.*)")
20 | async def mencode(event):
21 | msg = await event.eor(get_string("com_1"))
22 | text = event.pattern_match.group(1)
23 | if not text:
24 | return msg.edit("Please give a text!")
25 | base_url = "https://apis.xditya.me/morse/encode?text=" + text
26 | encoded = await async_searcher(base_url, re_content=False)
27 | await msg.edit("**Encoded.**\n\n**Morse Code:** `{}`".format(encoded))
28 |
29 |
30 | @ultroid_cmd(pattern="mdecode ?(.*)")
31 | async def mencode(event):
32 | msg = await event.eor(get_string("com_1"))
33 | text = event.pattern_match.group(1)
34 | if not text:
35 | return await msg.edit("Please give a text!")
36 | base_url = "https://apis.xditya.me/morse/decode?text=" + text
37 | encoded = await async_searcher(base_url, re_content=False)
38 | await msg.edit("**Decoded.**\n\n**Message:** `{}`".format(encoded))
--------------------------------------------------------------------------------
/ncode.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}ncode `
12 | Use - Paste the contents of file and send as pic.
13 | """
14 |
15 | import os, pygments
16 | from pygments.formatters import ImageFormatter
17 | from pygments.lexers import Python3Lexer
18 | from . import ultroid_cmd, check_filename
19 |
20 |
21 | @ultroid_cmd(pattern="ncode$")
22 | async def coder_print(event):
23 | if not event.reply_to_msg_id:
24 | return await event.eor("`Reply to a file or message!`", time=5)
25 | msg = await event.get_reply_message()
26 | if msg.document:
27 | a = await event.client.download_media(
28 | await event.get_reply_message(), check_filename("ncode.png")
29 | )
30 | with open(a, "r") as s:
31 | c = s.read()
32 | else:
33 | a = None
34 | c = msg.text
35 | pygments.highlight(
36 | c,
37 | Python3Lexer(),
38 | ImageFormatter(line_numbers=True, font_name="./resources/fonts/DroidSansMono.ttf"),
39 | check_filename("result.png"),
40 | )
41 | res = await event.client.send_message(
42 | event.chat_id,
43 | "**Pasting this code on my page...**",
44 | reply_to=event.reply_to_msg_id,
45 | )
46 | await event.client.send_file(
47 | event.chat_id, "result.png", force_document=True, reply_to=event.reply_to_msg_id
48 | )
49 | await res.delete()
50 | await event.delete()
51 | if a:
52 | os.remove(a)
53 | os.remove("result.png")
--------------------------------------------------------------------------------
/ocr.py:
--------------------------------------------------------------------------------
1 | #
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 | #
8 |
9 |
10 | """
11 | ✘ Commands Available -
12 |
13 | • `{i}ocr `
14 | text recognition service.
15 | """
16 |
17 |
18 | from telegraph import upload_file as uf
19 |
20 | from . import *
21 |
22 | TE = f"API not found, Please get it from ocr.space and set\n\ncommand `{HNDLR}setdb OCR_API your-api-key`"
23 |
24 |
25 | @ultroid_cmd(pattern="ocr ?(.*)")
26 | async def ocrify(ult):
27 | if not ult.is_reply:
28 | return await ult.eor("`Reply to Photo...`")
29 | msg = await ult.eor("`Processing..`")
30 | OAPI = udB.get_key("OCR_API")
31 | if not OAPI:
32 | return await msg.edit(TE)
33 | pat = ult.pattern_match.group(1)
34 | repm = await ult.get_reply_message()
35 | if not (repm.media and repm.media.photo):
36 | return await msg.edit("`Not a Photo..`")
37 | dl = await repm.download_media()
38 | atr = ""
39 | if pat:
40 | atr = f"&language={pat}"
41 | tt = uf(dl)
42 | li = "https://telegra.ph" + tt[0]
43 | gr = await async_searcher(
44 | f"https://api.ocr.space/parse/imageurl?apikey={OAPI}{atr}&url={li}",
45 | re_json=True,
46 | )
47 | trt = gr["ParsedResults"][0]["ParsedText"]
48 | await msg.edit(f"**🎉 OCR PORTAL\n\nRESULTS ~ ** `{trt}`")
49 |
--------------------------------------------------------------------------------
/pokedex.py:
--------------------------------------------------------------------------------
1 | # Creator - @THE_BL_ACK_HAT @Shivam_Patel
2 | #
3 | # Ultroid - UserBot
4 | #
5 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
6 | # PLease read the GNU Affero General Public License in
7 | # .
8 |
9 | """
10 | ✘ Commands Available -
11 |
12 | • `{i}pokemon `
13 | Send details of Pokemon.
14 |
15 | • `{i}pokecard `
16 | Send Card of Pokemon.
17 | """
18 |
19 | from pokedex import pokedex as badhiya
20 |
21 | from . import ultroid_cmd, async_searcher
22 |
23 |
24 | @ultroid_cmd(pattern="pokemon ?(.*)")
25 | async def pokedex(event):
26 | pokemon = event.pattern_match.group(1).lower()
27 | if not pokemon:
28 | await event.eor("`Give a Pokemon Name`")
29 | return
30 | xx = await event.eor("`Booting up the pokedex.......`")
31 | move = await async_searcher(
32 | f"https://pokeapi.co/api/v2/pokemon/{pokemon}", re_json=True
33 | )["moves"]
34 | rw = f"https://some-random-api.ml/pokedex?pokemon={pokemon}"
35 | lol = await async_searcher(
36 | f"https://api.pokemontcg.io/v1/cards?name={pokemon}", re_json=True
37 | )
38 | a = await async_searcher(rw, re_json=True)
39 | try:
40 | name = a["name"]
41 | except Exception:
42 | await event.eor("`Be sure To give correct Name`")
43 | return
44 | typ = a["type"]
45 | species = a["species"]
46 | abilities = a["abilities"]
47 | height = a["height"]
48 | weight = a["weight"]
49 | esatge = a["family"]["evolutionStage"]
50 | try:
51 | weaknesses = lol["cards"][0]["weaknesses"][0]["type"]
52 | except BaseException:
53 | weaknesses = None
54 | l = a["family"]["evolutionLine"]
55 | # ambiguous variable name 'l' flake8(E741)
56 | if not l:
57 | line = "None"
58 | else:
59 | line = ", ".join(map(str, l))
60 | gen = a["generation"]
61 | try:
62 | move1 = move[0]["move"]["name"]
63 | except IndexError:
64 | move1 = None
65 | try:
66 | move2 = move[1]["move"]["name"]
67 | except IndexError:
68 | move2 = None
69 | try:
70 | move3 = move[2]["move"]["name"]
71 | except IndexError:
72 | move3 = None
73 | try:
74 | move4 = move[3]["move"]["name"]
75 | except IndexError:
76 | move4 = None
77 | try:
78 | move5 = move[4]["move"]["name"]
79 | except IndexError:
80 | move5 = None
81 | try:
82 | move6 = move[5]["move"]["name"]
83 | except IndexError:
84 | move6 = None
85 | try:
86 | move7 = move[6]["move"]["name"]
87 | except IndexError:
88 | move7 = None
89 | description = a["description"]
90 | typ = ", ".join(map(str, typ))
91 | Stats = a["stats"]
92 | species = ", ".join(map(str, species))
93 | abilities = ", ".join(map(str, abilities))
94 | poli = badhiya.Pokedex()
95 | pname = poli.get_pokemon_by_name(pokemon)
96 | pokemon = pname[0]
97 | lst = pokemon.get("sprite")
98 | cap = f"""
99 |
100 | **NAME** : `{name}`
101 | **TYPE** : `{typ}`
102 | **SPECIES** : `{species}`
103 | **Evolution Line** : `{line}`
104 | **Evolution Stage** : `{esatge}`
105 | **Generation** : `{gen}`
106 | **ABILITIES** : `{abilities}`
107 | **WEAKNESSES** :`{weaknesses}`
108 | **HEIGHT** : `{height}`
109 | **WEIGHT** : `{weight}`
110 |
111 | **Stats** **Moves**
112 | **Hp** : `{Stats['hp']}` `(1){move1}`
113 | **Attack** : `{Stats['attack']}` `(2){move2}`
114 | **Defense** : `{Stats['defense']}` `(3){move3}`
115 | **Sp_atk** : `{Stats['sp_atk']}` `(4){move4}`
116 | **Sp_def** : `{Stats['sp_def']}` `(5){move5}`
117 | **Speed** : `{Stats['speed']}` `(6){move6}`
118 | **Total** : `{Stats['total']}` `(7){move7}`
119 | **DESCRIPTION** : `{description}`
120 | """
121 | await event.client.send_file(event.chat_id, lst, caption=cap)
122 | await xx.delete()
123 |
124 |
125 | @ultroid_cmd(pattern="pokecard ?(.*)")
126 | async def pokecard(event):
127 | pokename = event.pattern_match.group(1).lower()
128 | if not pokename:
129 | await event.eor("`Give A Pokemon name`")
130 | return
131 | rw = f"https://api.pokemontcg.io/v1/cards?name={pokename}"
132 | a = await async_searcher(rw, re_json=True)
133 | try:
134 | o = a["cards"][0]["imageUrlHiRes"]
135 | await event.client.send_file(
136 | await event.client.get_input_entity(event.chat_id), o
137 | )
138 | await event.delete()
139 | except BaseException:
140 | await event.eor("`Be sure To give correct Name`")
141 | return
142 |
--------------------------------------------------------------------------------
/quote.py:
--------------------------------------------------------------------------------
1 | #
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}qbot `
12 | Make sticker quote without QuotlyBot
13 | """
14 |
15 |
16 | import json
17 | import os
18 | import random
19 | import textwrap
20 | import urllib
21 |
22 | import emoji
23 | from fontTools.ttLib import TTFont
24 | from PIL import Image, ImageDraw, ImageFont, ImageOps
25 | from telethon.tl import functions, types
26 | from telethon.errors.rpcerrorlist import UserNotParticipantError
27 | from . import *
28 |
29 | # Oringinal Source from Nicegrill: https://github.com/erenmetesar/NiceGrill/
30 | # Ported to Ultroid
31 |
32 |
33 | COLORS = [
34 | "#F07975",
35 | "#F49F69",
36 | "#F9C84A",
37 | "#8CC56E",
38 | "#6CC7DC",
39 | "#80C1FA",
40 | "#BCB3F9",
41 | "#E181AC",
42 | ]
43 |
44 |
45 | async def process(msg, user, client, reply, replied=None):
46 | # Importıng fonts and gettings the size of text
47 | font = ImageFont.truetype(
48 | "resources/fonts/Roboto-Medium.ttf", 43, encoding="utf-16"
49 | )
50 | font2 = ImageFont.truetype(
51 | "resources/fonts/Roboto-Regular.ttf", 33, encoding="utf-16"
52 | )
53 | mono = ImageFont.truetype(
54 | "resources/fonts/DroidSansMono.ttf", 30, encoding="utf-16"
55 | )
56 | italic = ImageFont.truetype(
57 | "resources/fonts/Roboto-Italic.ttf", 33, encoding="utf-16"
58 | )
59 | fallback = ImageFont.truetype("resources/fonts/Quivira.otf", 43, encoding="utf-16")
60 |
61 | # Splitting text
62 | maxlength = 0
63 | width = 0
64 | text = []
65 | for line in msg.split("\n"):
66 | length = len(line)
67 | if length > 43:
68 | text += textwrap.wrap(line, 43)
69 | maxlength = 43
70 | if width < fallback.getsize(line[:43])[0]:
71 | if "MessageEntityCode" in str(reply.entities):
72 | width = mono.getsize(line[:43])[0] + 30
73 | else:
74 | width = fallback.getsize(line[:43])[0]
75 | else:
76 | text.append(line + "\n")
77 | if width < fallback.getsize(line)[0]:
78 | if "MessageEntityCode" in str(reply.entities):
79 | width = mono.getsize(line)[0] + 30
80 | else:
81 | width = fallback.getsize(line)[0]
82 | if maxlength < length:
83 | maxlength = length
84 |
85 | title = ""
86 | try:
87 | details = await client(
88 | functions.channels.GetParticipantRequest(reply.chat_id, user.id)
89 | )
90 | if isinstance(details.participant, types.ChannelParticipantCreator):
91 | title = details.participant.rank if details.participant.rank else "Creator"
92 | elif isinstance(details.participant, types.ChannelParticipantAdmin):
93 | title = details.participant.rank if details.participant.rank else "Admin"
94 | except (TypeError, UserNotParticipantError):
95 | pass
96 | except Exception as er:
97 | LOGS.exception(er)
98 | titlewidth = font2.getsize(title)[0]
99 |
100 | # Get user name
101 | lname = "" if not user.last_name else user.last_name
102 | tot = user.first_name + " " + lname
103 |
104 | namewidth = fallback.getsize(tot)[0] + 10
105 |
106 | if namewidth > width:
107 | width = namewidth
108 | width += titlewidth + 30 if titlewidth > width - namewidth else -(titlewidth - 30)
109 | height = len(text) * 40
110 |
111 | # Profile Photo BG
112 | pfpbg = Image.new("RGBA", (125, 600), (0, 0, 0, 0))
113 |
114 | # Draw Template
115 | top, middle, bottom = await drawer(width, height)
116 | # Profile Photo Check and Fetch
117 | yes = False
118 | color = random.choice(COLORS)
119 | async for photo in client.iter_profile_photos(user, limit=1):
120 | yes = True
121 | if yes:
122 | pfp = await client.download_profile_photo(user)
123 | paste = Image.open(pfp)
124 | os.remove(pfp)
125 | paste.thumbnail((105, 105))
126 |
127 | # Mask
128 | mask_im = Image.new("L", paste.size, 0)
129 | draw = ImageDraw.Draw(mask_im)
130 | draw.ellipse((0, 0, 105, 105), fill=255)
131 |
132 | # Apply Mask
133 | pfpbg.paste(paste, (0, 0), mask_im)
134 | else:
135 | paste, color = await no_photo(user, tot)
136 | pfpbg.paste(paste, (0, 0))
137 |
138 | # Creating a big canvas to gather all the elements
139 | canvassize = (
140 | middle.width + pfpbg.width,
141 | top.height + middle.height + bottom.height,
142 | )
143 | canvas = Image.new("RGBA", canvassize)
144 | draw = ImageDraw.Draw(canvas)
145 |
146 | y = 80
147 | if replied:
148 | # Creating a big canvas to gather all the elements
149 | replname = "" if not replied.sender.last_name else replied.sender.last_name
150 | fname = "" if not replied.sender.first_name else replied.sender.first_name
151 | reptot = fname + " " + replname
152 | if reply.sticker:
153 | sticker = await reply.download_media()
154 | stimg = Image.open(sticker)
155 | canvas = canvas.resize((stimg.width + pfpbg.width, stimg.height + 160))
156 | top = Image.new("RGBA", (200 + stimg.width, 300), (29, 29, 29, 255))
157 | draw = ImageDraw.Draw(top)
158 | await replied_user(
159 | draw, reptot, replied.message.replace("\n", " "), 20, len(title)
160 | )
161 | top = top.crop((135, 70, top.width, 300))
162 | canvas.paste(pfpbg, (0, 0))
163 | canvas.paste(top, (pfpbg.width + 10, 0))
164 | canvas.paste(stimg, (pfpbg.width + 10, 140))
165 | os.remove(sticker)
166 | return True, canvas
167 | canvas = canvas.resize((canvas.width + 60, canvas.height + 120))
168 | top, middle, bottom = await drawer(middle.width + 60, height + 105)
169 | canvas.paste(pfpbg, (0, 0))
170 | canvas.paste(top, (pfpbg.width, 0))
171 | canvas.paste(middle, (pfpbg.width, top.height))
172 | canvas.paste(bottom, (pfpbg.width, top.height + middle.height))
173 | draw = ImageDraw.Draw(canvas)
174 | if replied.sticker:
175 | replied.text = "Sticker"
176 | elif replied.photo:
177 | replied.text = "Photo"
178 | elif replied.audio:
179 | replied.text = "Audio"
180 | elif replied.voice:
181 | replied.text = "Voice Message"
182 | elif replied.document:
183 | replied.text = "Document"
184 | await replied_user(
185 | draw,
186 | reptot,
187 | replied.message.replace("\n", " "),
188 | maxlength + len(title),
189 | len(title),
190 | )
191 | y = 200
192 | elif reply.sticker:
193 | sticker = await reply.download_media()
194 | stimg = Image.open(sticker)
195 | canvas = canvas.resize((stimg.width + pfpbg.width + 30, stimg.height + 10))
196 | canvas.paste(pfpbg, (0, 0))
197 | canvas.paste(stimg, (pfpbg.width + 10, 10))
198 | os.remove(sticker)
199 | return True, canvas
200 | elif reply.document and not reply.audio and not reply.audio:
201 | docname = ".".join(reply.document.attributes[-1].file_name.split(".")[:-1])
202 | doctype = reply.document.attributes[-1].file_name.split(".")[-1].upper()
203 | if reply.document.size < 1024:
204 | docsize = str(reply.document.size) + " Bytes"
205 | elif reply.document.size < 1048576:
206 | docsize = str(round(reply.document.size / 1024, 2)) + " KB "
207 | elif reply.document.size < 1073741824:
208 | docsize = str(round(reply.document.size / 1024**2, 2)) + " MB "
209 | else:
210 | docsize = str(round(reply.document.size / 1024**3, 2)) + " GB "
211 | docbglen = (
212 | font.getsize(docsize)[0]
213 | if font.getsize(docsize)[0] > font.getsize(docname)[0]
214 | else font.getsize(docname)[0]
215 | )
216 | canvas = canvas.resize((pfpbg.width + width + docbglen, 160 + height))
217 | top, middle, bottom = await drawer(width + docbglen, height + 30)
218 | canvas.paste(pfpbg, (0, 0))
219 | canvas.paste(top, (pfpbg.width, 0))
220 | canvas.paste(middle, (pfpbg.width, top.height))
221 | canvas.paste(bottom, (pfpbg.width, top.height + middle.height))
222 | canvas = await doctype(docname, docsize, doctype, canvas)
223 | y = 80 if text else 0
224 | else:
225 | canvas.paste(pfpbg, (0, 0))
226 | canvas.paste(top, (pfpbg.width, 0))
227 | canvas.paste(middle, (pfpbg.width, top.height))
228 | canvas.paste(bottom, (pfpbg.width, top.height + middle.height))
229 | y = 85
230 |
231 | # Writing User's Name
232 | space = pfpbg.width + 30
233 | namefallback = ImageFont.truetype(
234 | "resources/fonts/Quivira.otf", 43, encoding="utf-16"
235 | )
236 | for letter in tot:
237 | if letter in emoji.UNICODE_EMOJI:
238 | newemoji, mask = await emoji_fetch(letter)
239 | canvas.paste(newemoji, (space, 24), mask)
240 | space += 40
241 | else:
242 | if not await fontTest(letter):
243 | draw.text((space, 20), letter, font=namefallback, fill=color)
244 | space += namefallback.getsize(letter)[0]
245 | else:
246 | draw.text((space, 20), letter, font=font, fill=color)
247 | space += font.getsize(letter)[0]
248 |
249 | if title:
250 | draw.text(
251 | (canvas.width - titlewidth - 20, 25), title, font=font2, fill="#898989"
252 | )
253 |
254 | # Writing all separating emojis and regular texts
255 | x = pfpbg.width + 30
256 | bold, mono, italic, link = await get_entity(reply)
257 | index = 0
258 | emojicount = 0
259 | textfallback = ImageFont.truetype(
260 | "resources/fonts/Quivira.otf", 33, encoding="utf-16"
261 | )
262 | textcolor = "white"
263 | for line in text:
264 | for letter in line:
265 | index = (
266 | msg.find(letter) if emojicount == 0 else msg.find(letter) + emojicount
267 | )
268 | for offset, length in bold.items():
269 | if index in range(offset, length):
270 | font2 = ImageFont.truetype(
271 | "resources/fonts/Roboto-Medium.ttf", 33, encoding="utf-16"
272 | )
273 | textcolor = "white"
274 | for offset, length in italic.items():
275 | if index in range(offset, length):
276 | font2 = ImageFont.truetype(
277 | "resources/fonts/Roboto-Italic.ttf", 33, encoding="utf-16"
278 | )
279 | textcolor = "white"
280 | for offset, length in mono.items():
281 | if index in range(offset, length):
282 | font2 = ImageFont.truetype(
283 | "resources/fonts/DroidSansMono.ttf", 30, encoding="utf-16"
284 | )
285 | textcolor = "white"
286 | for offset, length in link.items():
287 | if index in range(offset, length):
288 | font2 = ImageFont.truetype(
289 | "resources/fonts/Roboto-Regular.ttf", 30, encoding="utf-16"
290 | )
291 | textcolor = "#898989"
292 | if letter in emoji.UNICODE_EMOJI:
293 | newemoji, mask = await emoji_fetch(letter)
294 | canvas.paste(newemoji, (x, y - 2), mask)
295 | x += 45
296 | emojicount += 1
297 | else:
298 | if not await fontTest(letter):
299 | draw.text((x, y), letter, font=textfallback, fill=textcolor)
300 | x += textfallback.getsize(letter)[0]
301 | else:
302 | draw.text((x, y), letter, font=font2, fill=textcolor)
303 | x += font2.getsize(letter)[0]
304 | msg = msg.replace(letter, "¶", 1)
305 | y += 40
306 | x = pfpbg.width + 30
307 | return True, canvas
308 |
309 |
310 | async def drawer(width, height):
311 | # Top part
312 | top = Image.new("RGBA", (width, 20), (0, 0, 0, 0))
313 | draw = ImageDraw.Draw(top)
314 | draw.line((10, 0, top.width - 20, 0), fill=(29, 29, 29, 255), width=50)
315 | draw.pieslice((0, 0, 30, 50), 180, 270, fill=(29, 29, 29, 255))
316 | draw.pieslice((top.width - 75, 0, top.width, 50), 270, 360, fill=(29, 29, 29, 255))
317 |
318 | # Middle part
319 | middle = Image.new("RGBA", (top.width, height + 75), (29, 29, 29, 255))
320 |
321 | # Bottom part
322 | bottom = ImageOps.flip(top)
323 |
324 | return top, middle, bottom
325 |
326 |
327 | async def fontTest(letter):
328 | test = TTFont("resources/fonts/Roboto-Medium.ttf")
329 | for table in test["cmap"].tables:
330 | if ord(letter) in table.cmap.keys():
331 | return True
332 |
333 |
334 | async def get_entity(msg):
335 | bold = {0: 0}
336 | italic = {0: 0}
337 | mono = {0: 0}
338 | link = {0: 0}
339 | if not msg.entities:
340 | return bold, mono, italic, link
341 | for entity in msg.entities:
342 | if isinstance(entity, types.MessageEntityBold):
343 | bold[entity.offset] = entity.offset + entity.length
344 | elif isinstance(entity, types.MessageEntityItalic):
345 | italic[entity.offset] = entity.offset + entity.length
346 | elif isinstance(entity, types.MessageEntityCode):
347 | mono[entity.offset] = entity.offset + entity.length
348 | elif isinstance(entity, types.MessageEntityUrl):
349 | link[entity.offset] = entity.offset + entity.length
350 | elif isinstance(entity, types.MessageEntityTextUrl):
351 | link[entity.offset] = entity.offset + entity.length
352 | elif isinstance(entity, types.MessageEntityMention):
353 | link[entity.offset] = entity.offset + entity.length
354 | return bold, mono, italic, link
355 |
356 |
357 | async def doctype(name, size, _type, canvas):
358 | font = ImageFont.truetype("resources/fonts/Roboto-Medium.ttf", 38)
359 | doc = Image.new("RGBA", (130, 130), (29, 29, 29, 255))
360 | draw = ImageDraw.Draw(doc)
361 | draw.ellipse((0, 0, 130, 130), fill="#434343")
362 | draw.line((66, 28, 66, 53), width=14, fill="white")
363 | draw.polygon([(67, 77), (90, 53), (42, 53)], fill="white")
364 | draw.line((40, 87, 90, 87), width=8, fill="white")
365 | canvas.paste(doc, (160, 23))
366 | draw2 = ImageDraw.Draw(canvas)
367 | draw2.text((320, 40), name, font=font, fill="white")
368 | draw2.text((320, 97), size + _type, font=font, fill="#AAAAAA")
369 | return canvas
370 |
371 |
372 | async def no_photo(reply, tot):
373 | pfp = Image.new("RGBA", (105, 105), (0, 0, 0, 0))
374 | pen = ImageDraw.Draw(pfp)
375 | color = random.choice(COLORS)
376 | pen.ellipse((0, 0, 105, 105), fill=color)
377 | letter = "" if not tot else tot[0]
378 | font = ImageFont.truetype("resources/fonts/Roboto-Regular.ttf", 60)
379 | pen.text((32, 17), letter, font=font, fill="white")
380 | return pfp, color
381 |
382 |
383 | async def emoji_fetch(emoji):
384 | emojis = json.loads(
385 | urllib.request.urlopen(
386 | "https://github.com/erenmetesar/modules-repo/raw/master/emojis.txt"
387 | )
388 | .read()
389 | .decode()
390 | )
391 | if emoji in emojis:
392 | img = emojis[emoji]
393 | return await transparent(
394 | urllib.request.urlretrieve(img, "resources/emoji.png")[0]
395 | )
396 | img = emojis["⛔"]
397 | return await transparent(urllib.request.urlretrieve(img, "resources/emoji.png")[0])
398 |
399 |
400 | async def transparent(emoji):
401 | emoji = Image.open(emoji).convert("RGBA")
402 | emoji.thumbnail((40, 40))
403 |
404 | # Mask
405 | mask = Image.new("L", (40, 40), 0)
406 | draw = ImageDraw.Draw(mask)
407 | draw.ellipse((0, 0, 40, 40), fill=255)
408 | return emoji, mask
409 |
410 |
411 | async def replied_user(draw, tot, text, maxlength, title):
412 | namefont = ImageFont.truetype("resources/fonts/Roboto-Medium.ttf", 38)
413 | namefallback = ImageFont.truetype("resources/fonts/Quivira.otf", 38)
414 | textfont = ImageFont.truetype("resources/fonts/Roboto-Regular.ttf", 32)
415 | textfallback = ImageFont.truetype("resources/fonts/Roboto-Medium.ttf", 38)
416 | maxlength = maxlength + 7 if maxlength < 10 else maxlength
417 | text = text[: maxlength - 2] + ".." if len(text) > maxlength else text
418 | draw.line((165, 90, 165, 170), width=5, fill="white")
419 | space = 0
420 | for letter in tot:
421 | if not await fontTest(letter):
422 | draw.text((180 + space, 86), letter, font=namefallback, fill="#888888")
423 | space += namefallback.getsize(letter)[0]
424 | else:
425 | draw.text((180 + space, 86), letter, font=namefont, fill="#888888")
426 | space += namefont.getsize(letter)[0]
427 | space = 0
428 | for letter in text:
429 | if not await fontTest(letter):
430 | draw.text((180 + space, 132), letter, font=textfallback, fill="#888888")
431 | space += textfallback.getsize(letter)[0]
432 | else:
433 | draw.text((180 + space, 132), letter, font=textfont, fill="white")
434 | space += textfont.getsize(letter)[0]
435 |
436 |
437 | @ultroid_cmd(pattern="qbot$")
438 | async def _(event):
439 | reply = await event.get_reply_message()
440 | msg = reply.message
441 | repliedreply = await reply.get_reply_message()
442 | user = await reply.get_sender()
443 | res, canvas = await process(msg, user, event.client, reply, repliedreply)
444 | if not res:
445 | return
446 | canvas.save("sticker.webp")
447 | await event.client.send_file(
448 | event.chat_id, "sticker.webp", reply_to=event.reply_to_msg_id
449 | )
450 | os.remove("sticker.webp")
451 |
--------------------------------------------------------------------------------
/quotefancy.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 |
9 | """
10 | ✘ Commands Available
11 |
12 | • `{i}qfancy`
13 | Gets random quotes from QuoteFancy.com.
14 | """
15 |
16 | from telethon.errors import ChatSendMediaForbiddenError
17 |
18 | from quotefancy import get_quote
19 |
20 | from . import *
21 |
22 |
23 | @ultroid_cmd(pattern="qfancy$")
24 | async def quotefancy(e):
25 | mes = await e.eor(get_string("com_1"))
26 | img = get_quote("img", download=True)
27 | try:
28 | await e.client.send_file(e.chat_id, img)
29 | os.remove(img)
30 | await mes.delete()
31 | except ChatSendMediaForbiddenError:
32 | quote = get_quote("text")
33 | await eor(mes, f"`{quote}`")
34 | except Exception as err:
35 | await eor(mes, f"**ERROR** - {err}")
36 |
--------------------------------------------------------------------------------
/random.py:
--------------------------------------------------------------------------------
1 | #
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `Get some Random Content.`
12 |
13 | • `{i}random dog`
14 | • `{i}random duck`
15 | • `{i}random cat`
16 | • `{i}random fox`
17 | • `{i}random quote`
18 | • `{i}random word`
19 | • `{i}random car`
20 | • `{i}random celebrity`
21 | """
22 |
23 | from bs4 import BeautifulSoup as bs
24 | import re
25 |
26 | from . import HNDLR, async_searcher, ultroid_cmd
27 |
28 | # These Api's are Collected From
29 | # ---- https://github.com/public-apis/public-apis
30 |
31 | API_LIST = {
32 | "cat": "https://aws.random.cat/meow",
33 | "dog": "https://random.dog/woof.json",
34 | "duck": "https://random-d.uk/api/random",
35 | "fox": "https://randomfox.ca/floof/",
36 | # "funfact": "https://asli-fun-fact-api.herokuapp.com/",
37 | "quote": "https://api.themotivate365.com/stoic-quote",
38 | "quotable": "http://api.quotable.io/random",
39 | # "words": "https://random-word-api.herokuapp.com/word?number=10",
40 | # "food": "https://foodish-api.herokuapp.com/api/",
41 | "car": "https://forza-api.tk/",
42 | }
43 |
44 | SCRAP_LIST = {
45 | "celebrity": "https://www.randomcelebritygenerator.com/",
46 | "word": "https://randomword.com/",
47 | }
48 |
49 |
50 | @ultroid_cmd(pattern="random ?(.*)")
51 | async def random_magic(event):
52 | if "randomuser" in event.text:
53 | return
54 | match = event.pattern_match.group(1)
55 | if not (match and match in [*list(API_LIST.keys()), *list(SCRAP_LIST.keys())]):
56 | return await event.eor(f"`Input Missing/Wrong..`\n`{HNDLR}help random`")
57 | text, bsC, file = None, None, None
58 | ret = match in SCRAP_LIST
59 | try:
60 | req = await async_searcher(
61 | API_LIST.get(match) or SCRAP_LIST.get(match),
62 | re_json=not ret,
63 | re_content=ret,
64 | )
65 | except Exception as er:
66 | return await event.eor(str(er))
67 | if ret:
68 | bsC = bs(req, "html.parser", from_encoding="utf-8")
69 | if match == "cat":
70 | file = req["file"]
71 | elif match in ["dog", "duck"]:
72 | file = req["url"]
73 | elif match in ["car", "fox", "food"]:
74 | file = req["image"]
75 | elif match == "funfact":
76 | text = req["data"]["fact"]
77 | elif match == "quote":
78 | text = f"**{req['data']['quote']}**\n\n~ {req['data']['author']}"
79 | elif match == "quotable":
80 | text = f'`{req["content"]}`' + "~ `{req['author']}`"
81 | elif match == "word":
82 | req = req.decode("utf-8")
83 | word = re.search(r'([^<]+)
', req).group(1)
84 | definition = re.search(r'([^<]*)
', req).group(1)
85 | text = f"**Random Word**\n- `{word}` : `{definition}`"
86 | elif match == "words":
87 | text = "**• Random Words**\n\n"
88 | for word in req:
89 | text += f"--`{word}`\n"
90 | elif match == "celebrity" and bsC:
91 | file = SCRAP_LIST[match] + bsC.find("img", "featured-celebrity-image")["src"]
92 | name = bsC.find("div", "info").find("h1").text
93 | text = f"• **Name :** `{name}`\n"
94 | desc = bsC.find("p", "fame").text.replace("\n", "")
95 | text += f" - __{desc}__\n\n"
96 | bd = bsC.find("p", "birth-dates").text.replace("\n", "")
97 | text += f"• **Birth Dates :** {bd}\n"
98 | text += "-" * 10
99 | if text and not file:
100 | return await event.eor(text)
101 | await event.reply(text, file=file)
102 | await event.delete()
--------------------------------------------------------------------------------
/searchmsgs.py:
--------------------------------------------------------------------------------
1 | # " Made by @e3ris for Ultroid. "
2 | # < https://github.com/TeamUltroid/Ultroid >
3 | # idea: https://t.me/TelethonChat/256160
4 |
5 |
6 | """
7 | ✘ To Search Messages in chat easily :)
8 |
9 | ✘ **CMD** :
10 | >> {i}search (some_text)
11 | >> {i}search -r (some_text) : 10
12 | »» To search in Reverse order.
13 |
14 | ✘ **Examples** :
15 | • `{i}search Ultroid`
16 | • `{i}search -r Heroku : 10`
17 | """
18 |
19 |
20 | @ultroid_cmd(pattern="search( -r|) ?(.*)")
21 | async def searcher(e):
22 | eris = await e.eor("`Working..`")
23 | args = e.pattern_match.group(2)
24 | limit = 5
25 | if not args or len(args) < 2:
26 | await eod(eris, "Invalid argument!, Try again")
27 | return
28 |
29 | if ":" in args:
30 | args, limit = args.split(":", 1)
31 | try:
32 | limit = int(limit)
33 | except BaseException:
34 | limit = 5
35 |
36 | limit = 99 if limit > 99 else limit
37 | text, c = "", 0
38 | async for msg in e.client.iter_messages(
39 | e.chat_id,
40 | search=args.strip(),
41 | limit=limit,
42 | reverse=bool(e.pattern_match.group(1)),
43 | ):
44 | text += f" [»» {msg.id}](t.me/c/{e.chat.id}/{msg.id})\n"
45 | c += 1
46 |
47 | txt = (
48 | f"**Results for :** `{args}` \n\n{text}"
49 | if c > 0
50 | else f"**No Results for :** `{args}`"
51 | )
52 | await eris.edit(txt)
53 |
--------------------------------------------------------------------------------
/song.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright 2020 (c)
3 |
4 | # Lyrics ported from Dark Cobra
5 | #
6 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
7 | # PLease read the GNU Affero General Public License in
8 | # .
9 |
10 |
11 | """
12 | ✘ Commands Available -
13 | • `{i}lyrics `
14 | get lyrics of song.
15 |
16 | • `{i}songs `
17 | alternative song command.
18 | """
19 |
20 |
21 | import random
22 |
23 | from lyrics_extractor import SongLyrics as sl
24 | from lyrics_extractor.lyrics import LyricScraperException as LyError
25 | from telethon.errors.rpcerrorlist import UserAlreadyParticipantError
26 | from telethon.tl.functions.messages import ImportChatInviteRequest
27 | from telethon.tl.types import InputMessagesFilterMusic as filtermus
28 |
29 | from . import *
30 |
31 |
32 | @ultroid_cmd(pattern=r"lyrics ?(.*)")
33 | async def original(event):
34 | if not event.pattern_match.group(1):
35 | return await event.eor("give query to search.")
36 | noob = event.pattern_match.group(1)
37 | ab = await event.eor("Getting lyrics..")
38 | dc = random.randrange(1, 3)
39 | if dc == 1:
40 | danish = "AIzaSyAyDBsY3WRtB5YPC6aB_w8JAy6ZdXNc6FU"
41 | elif dc == 2:
42 | danish = "AIzaSyBF0zxLlYlPMp9xwMQqVKCQRq8DgdrLXsg"
43 | else:
44 | danish = "AIzaSyDdOKnwnPwVIQ_lbH5sYE4FoXjAKIQV0DQ"
45 | extract_lyrics = sl(danish, "15b9fb6193efd5d90")
46 | try:
47 | sh1vm = await extract_lyrics.get_lyrics(noob)
48 | except LyError:
49 | return await eod(event, "No Results Found")
50 | a7ul = sh1vm["lyrics"]
51 | await event.client.send_message(event.chat_id, a7ul, reply_to=event.reply_to_msg_id)
52 | await ab.delete()
53 |
54 |
55 | @ultroid_cmd(pattern="song ?(.*)")
56 | async def _(event):
57 | ultroid_bot = event.client
58 | try:
59 | await ultroid_bot(ImportChatInviteRequest("DdR2SUvJPBouSW4QlbJU4g"))
60 | except UserAlreadyParticipantError:
61 | pass
62 | except Exception:
63 | return await eor(
64 | event,
65 | "You need to join [this]"
66 | + "(https://t.me/joinchat/DdR2SUvJPBouSW4QlbJU4g)"
67 | + "group for this module to work.",
68 | )
69 | args = event.pattern_match.group(1)
70 | if not args:
71 | return await event.eor("`Enter song name`")
72 | okla = await event.eor("processing...")
73 | chat = -1001271479322
74 | current_chat = event.chat_id
75 | try:
76 | async for event in ultroid_bot.iter_messages(
77 | chat, search=args, limit=1, filter=filtermus
78 | ):
79 | await ultroid_bot.send_file(current_chat, event, caption=event.message)
80 | await okla.delete()
81 | except Exception:
82 | return await okla.eor("`Song not found.`")
83 |
--------------------------------------------------------------------------------
/spam.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 | • `{i}spam `
11 | `{i}spam `
12 | spams chat, the current limit for this is from 1 to 99.
13 |
14 | • `{i}bigspam `
15 | `{i}bigspam `
16 | Spams chat, the current limit is above 100.
17 |
18 | • `{i}delayspam `
19 | Spam chat with delays..
20 |
21 | • `{i}tspam `
22 | Spam Chat with One-One Character..
23 | """
24 |
25 | import asyncio
26 |
27 | from . import *
28 |
29 |
30 | @ultroid_cmd(pattern="tspam")
31 | async def tmeme(e):
32 | tspam = str(e.text[7:])
33 | message = tspam.replace(" ", "")
34 | for letter in message:
35 | await e.respond(letter)
36 | await e.delete()
37 |
38 |
39 | @ultroid_cmd(pattern="spam")
40 | async def spammer(e):
41 | message = e.text
42 | if e.reply_to:
43 | if not len(message.split()) >= 2:
44 | return await eod(e, "`Use in Proper Format`")
45 | spam_message = await e.get_reply_message()
46 | else:
47 | if not len(message.split()) >= 3:
48 | return await eod(e, "`Reply to a Message or Give some Text..`")
49 | spam_message = message.split(maxsplit=2)[2]
50 | counter = message.split()[1]
51 | try:
52 | counter = int(counter)
53 | if counter >= 100:
54 | return await eod(e, "`Use bigspam cmd`")
55 | except BaseException:
56 | return await eod(e, "`Use in Proper Format`")
57 | tasks = [asyncio.create_task(e.respond(spam_message)) for _ in range(counter)]
58 | await asyncio.wait(tasks)
59 | await e.delete()
60 |
61 |
62 | @ultroid_cmd(pattern="bigspam", fullsudo=True)
63 | async def bigspam(e):
64 | message = e.text
65 | if e.reply_to:
66 | if not len(message.split()) >= 2:
67 | return await eod(e, "`Use in Proper Format`")
68 | spam_message = await e.get_reply_message()
69 | else:
70 | if not len(message.split()) >= 3:
71 | return await eod(e, "`Reply to a Message or Give some Text..`")
72 | spam_message = message.split(maxsplit=2)[2]
73 | counter = message.split()[1]
74 | try:
75 | counter = int(counter)
76 | except BaseException:
77 | return await eod(e, "`Use in Proper Format`")
78 | await asyncio.wait([e.respond(spam_message) for i in range(counter)])
79 | await e.delete()
80 |
81 |
82 | @ultroid_cmd(pattern="delayspam ?(.*)")
83 | async def delayspammer(e):
84 | try:
85 | args = e.text.split(" ", 3)
86 | delay = float(args[1])
87 | count = int(args[2])
88 | msg = str(args[3])
89 | except BaseException:
90 | return await e.edit(f"**Usage :** {HNDLR}delayspam ")
91 | await e.delete()
92 | try:
93 | for i in range(count):
94 | await e.respond(msg)
95 | await asyncio.sleep(delay)
96 | except Exception as u:
97 | await e.respond(f"**Error :** `{u}`")
98 |
--------------------------------------------------------------------------------
/speechtool.py:
--------------------------------------------------------------------------------
1 | #
2 | # Ultroid - UserBot
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 | #
8 | # tts- Ported from Telebot
9 |
10 |
11 | """
12 | ✘ Commands Available -
13 |
14 | • `{i}tts` `LanguageCode `
15 | • `{i}tts` `LangaugeCode | text to speak`
16 |
17 | • `{i}stt` ``
18 | `Convert Speech to Text...`
19 | `Note - Sometimes Not 100% Accurate`
20 | """
21 |
22 | import os
23 | import subprocess
24 | from datetime import datetime
25 |
26 | import speech_recognition as sr
27 | from gtts import gTTS
28 |
29 | from . import *
30 |
31 | reco = sr.Recognizer()
32 |
33 |
34 | @ultroid_cmd(
35 | pattern="tts ?(.*)",
36 | )
37 | async def _(event):
38 | input_str = event.pattern_match.group(1)
39 | start = datetime.now()
40 | if event.reply_to_msg_id:
41 | previous_message = await event.get_reply_message()
42 | text = previous_message.message
43 | lan = input_str
44 | elif "|" in input_str:
45 | lan, text = input_str.split("|")
46 | else:
47 | await event.eor("Invalid Syntax. Module stopping.")
48 | return
49 | text = text.strip()
50 | lan = lan.strip()
51 | if not os.path.isdir("downloads/"):
52 | os.makedirs("downloads/")
53 | required_file_name = "downloads/voice.ogg"
54 | try:
55 | tts = gTTS(text, lang=lan)
56 | tts.save(required_file_name)
57 | command_to_execute = [
58 | "ffmpeg",
59 | "-i",
60 | required_file_name,
61 | "-map",
62 | "0:a",
63 | "-codec:a",
64 | "libopus",
65 | "-b:a",
66 | "100k",
67 | "-vbr",
68 | "on",
69 | required_file_name + ".opus",
70 | ]
71 | try:
72 | subprocess.check_output(command_to_execute, stderr=subprocess.STDOUT)
73 | except (subprocess.CalledProcessError, NameError, FileNotFoundError) as exc:
74 | await event.eor(str(exc))
75 | else:
76 | os.remove(required_file_name)
77 | required_file_name = required_file_name + ".opus"
78 | end = datetime.now()
79 | ms = (end - start).seconds
80 | await event.reply(
81 | file=required_file_name,
82 | )
83 | os.remove(required_file_name)
84 | await eod(event, "Processed {} ({}) in {} seconds!".format(text[0:97], lan, ms))
85 | except Exception as e:
86 | await event.eor(str(e))
87 |
88 |
89 | @ultroid_cmd(pattern="stt")
90 | async def speec_(e):
91 | reply = await e.get_reply_message()
92 | if not (reply and reply.media):
93 | return await eod(e, "`Reply to Audio-File..`")
94 | # Not Hard Checking File Types
95 | re = await reply.download_media()
96 | fn = re + ".wav"
97 | await bash(f'ffmpeg -i "{re}" -vn "{fn}"')
98 | with sr.AudioFile(fn) as source:
99 | audio = reco.record(source)
100 | try:
101 | text = reco.recognize_google(audio, language="en-IN")
102 | except Exception as er:
103 | return await e.eor(str(er))
104 | out = "**Extracted Text :**\n `" + text + "`"
105 | await e.eor(out)
106 | os.remove(fn)
107 | os.remove(re)
108 |
--------------------------------------------------------------------------------
/spellcheck.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • {i}spcheck
12 | check spelling of the text/sentence
13 | """
14 |
15 | from textblob import TextBlob
16 |
17 | from . import *
18 |
19 |
20 | @ultroid_cmd(pattern="spcheck ?(.*)")
21 | async def spellchk(event):
22 | to_check = event.pattern_match.group(1)
23 | if not to_check and event.is_reply:
24 | reply = await event.get_reply_message()
25 | if reply.text:
26 | to_check = reply.text
27 | if not (to_check or event.is_reply):
28 | return await event.eor("`Give me some text/sentence to check its spelling!.`")
29 | check = TextBlob(to_check)
30 | correct = check.correct()
31 | await eor(
32 | event, f"**Given Phrase:** `{to_check}`\n**Corrected Phrase:** `{correct}`"
33 | )
34 |
--------------------------------------------------------------------------------
/stickerspam.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | •`{i}sspam `
12 | it spam the whole stickers in that pack.
13 |
14 | """
15 |
16 | import asyncio
17 |
18 | from telethon.tl.functions.messages import GetStickerSetRequest
19 | from telethon.tl.types import InputStickerSetID, InputStickerSetShortName
20 | from telethon.utils import get_input_document
21 |
22 | from . import *
23 |
24 |
25 | @ultroid_cmd(pattern="sspam ?(.*)")
26 | async def _(e):
27 | match = e.pattern_match.group(1)
28 | x = await e.get_reply_message()
29 | if not (x and x.media and hasattr(x.media, "document")):
30 | return await eod(e, "`Reply To Sticker Only`")
31 | set = x.document.attributes[1]
32 | sset = await e.client(
33 | GetStickerSetRequest(
34 | InputStickerSetID(
35 | id=set.stickerset.id, access_hash=set.stickerset.access_hash
36 | ),
37 | hash=0,
38 | )
39 | )
40 | pack = sset.set.short_name
41 | docs = [
42 | get_input_document(x)
43 | for x in (
44 | await e.client(GetStickerSetRequest(InputStickerSetShortName(pack), hash=0))
45 | ).documents
46 | ]
47 | try:
48 | match = int(match)
49 | except ValueError:
50 | match = None
51 | for xx in docs:
52 | if match:
53 | await asyncio.sleep(match)
54 | await e.respond(file=xx)
55 |
--------------------------------------------------------------------------------
/sticklet.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}sticklet `
12 | `create random sticker with text.`
13 | """
14 |
15 | import io
16 | import os
17 | import random
18 | import textwrap
19 | from glob import glob
20 |
21 | from PIL import Image, ImageDraw, ImageFont
22 | from telethon.errors.rpcerrorlist import BotMethodInvalidError
23 | from telethon.tl.types import InputMessagesFilterDocument
24 |
25 | from . import *
26 |
27 |
28 | @ultroid_cmd(pattern="sticklet ?(.*)")
29 | async def sticklet(event):
30 | a = await event.eor(get_string("com_1"))
31 | R = random.randint(0, 256)
32 | G = random.randint(0, 256)
33 | B = random.randint(0, 256)
34 | if not event.pattern_match.group(1):
35 | try:
36 | msg = await event.get_reply_message()
37 | if msg and msg.text:
38 | sticktext = msg.text
39 | else:
40 | return await a.eor("`Give me some Text`")
41 | except BotMethodInvalidError:
42 | return await a.eor("`Give me some Text`")
43 | else:
44 | sticktext = event.pattern_match.group(1)
45 | if not sticktext:
46 | return await event.eor("`Give me some Text`")
47 | sticktext = textwrap.wrap(sticktext, width=10)
48 | # converts back the list to a string
49 | sticktext = "\n".join(sticktext)
50 | image = Image.new("RGBA", (512, 512), (255, 255, 255, 0))
51 | draw = ImageDraw.Draw(image)
52 | fontsize = 230
53 | font_file_ = glob("resources/fonts/*ttf")
54 | FONT_FILE = random.choice(font_file_)
55 | font = ImageFont.truetype(FONT_FILE, size=fontsize)
56 | for i in range(10):
57 | try:
58 | bbox = draw.multiline_textbbox((0, 0), sticktext, font=font)
59 | width, height = bbox[2] - bbox[0], bbox[3] - bbox[1]
60 | except AttributeError:
61 | width, height = draw.textsize(sticktext, font=font)
62 | if not (width > 512 or height > 512):
63 | break
64 | fontsize = 100
65 | font = ImageFont.truetype(FONT_FILE, size=fontsize)
66 | try:
67 | bbox = draw.multiline_textbbox((0, 0), sticktext, font=font)
68 | width, height = bbox[2] - bbox[0], bbox[3] - bbox[1]
69 | except AttributeError:
70 | width, height = draw.textsize(sticktext, font=font)
71 | draw.multiline_text(
72 | ((512 - width) / 2, (512 - height) / 2), sticktext, font=font, fill=(R, G, B)
73 | )
74 | image_stream = io.BytesIO()
75 | image_stream.name = check_filename("ult.webp")
76 | image.save(image_stream, "WebP")
77 | image_stream.seek(0)
78 | await a.delete()
79 | await event.client.send_message(
80 | event.chat_id,
81 | "{}".format(sticktext),
82 | file=image_stream,
83 | reply_to=event.message.reply_to_msg_id,
84 | )
85 |
--------------------------------------------------------------------------------
/test.py:
--------------------------------------------------------------------------------
1 | # Ported From DarkCobra Originally By UNIBORG
2 | #
3 | # Ultroid - UserBot
4 | #
5 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
6 | # PLease read the GNU Affero General Public License in
7 | # .
8 |
9 | """
10 | ✘ Commands Available -
11 |
12 | • `{i}test`
13 | Test Your Server Speed.
14 |
15 | """
16 |
17 | from datetime import datetime
18 |
19 | import speedtest
20 |
21 | from . import *
22 |
23 |
24 | @ultroid_cmd(pattern="test ?(.*)")
25 | async def _(event):
26 | input_str = event.pattern_match.group(1)
27 | as_document = None
28 | if input_str == "image":
29 | as_document = False
30 | elif input_str == "file":
31 | as_document = True
32 | xx = await event.eor("`Calculating ur Ultroid Server Speed. Please wait!`")
33 | start = datetime.now()
34 | s = speedtest.Speedtest()
35 | s.get_best_server()
36 | s.download()
37 | s.upload()
38 | end = datetime.now()
39 | ms = (end - start).seconds
40 | response = s.results.dict()
41 | download_speed = response.get("download")
42 | upload_speed = response.get("upload")
43 | ping_time = response.get("ping")
44 | client_infos = response.get("client")
45 | i_s_p = client_infos.get("isp")
46 | i_s_p_rating = client_infos.get("isprating")
47 | reply_msg_id = event.message.id
48 | if event.reply_to_msg_id:
49 | reply_msg_id = event.reply_to_msg_id
50 | try:
51 | response = s.results.share()
52 | speedtest_image = response
53 | if as_document is None:
54 | await xx.edit(
55 | """`Ultroid Server Speed in {} sec`
56 |
57 | `Download: {}`
58 | `Upload: {}`
59 | `Ping: {}`
60 | `Internet Service Provider: {}`
61 | `ISP Rating: {}`""".format(
62 | ms,
63 | humanbytes(download_speed),
64 | humanbytes(upload_speed),
65 | ping_time,
66 | i_s_p,
67 | i_s_p_rating,
68 | )
69 | )
70 | else:
71 | await event.client.send_file(
72 | event.chat_id,
73 | speedtest_image,
74 | caption="**SpeedTest** completed in {} seconds".format(ms),
75 | force_document=as_document,
76 | reply_to=reply_msg_id,
77 | allow_cache=False,
78 | )
79 | await event.delete()
80 | except Exception as exc: # dc
81 | await xx.edit(
82 | """**SpeedTest** completed in {} seconds
83 | Download: {}
84 | Upload: {}
85 | Ping: {}
86 |
87 |
88 | __With the Following ERRORs__
89 | {}""".format(
90 | ms,
91 | humanbytes(download_speed),
92 | humanbytes(upload_speed),
93 | ping_time,
94 | str(exc),
95 | )
96 | )
97 |
--------------------------------------------------------------------------------
/totalmsgs.py:
--------------------------------------------------------------------------------
1 | # credit https://t.me/I_m_FlaSh
2 |
3 | """
4 | ✘ Commands Available -
5 | • `{i}totalmsgs`
6 | Returns your total msg count in current chat
7 |
8 | • `{i}totalmsgs [username]/`
9 | Returns total msg count of user in current chat
10 | """
11 |
12 | from telethon.utils import get_display_name
13 |
14 | from . import *
15 |
16 |
17 | @ultroid_cmd(pattern="totalmsgs ?(.*)")
18 | async def _(e):
19 | match = e.pattern_match.group(1)
20 | if match:
21 | user = match
22 | elif e.is_reply:
23 | user = (await e.get_reply_message()).sender_id
24 | else:
25 | user = "me"
26 | try:
27 | a = await e.client.get_messages(e.chat_id, limit=0, from_user=user)
28 | except Exception as er:
29 | return await e.eor(str(er))
30 | user = await e.client.get_entity(user)
31 | await e.eor(f"Total msgs of `{get_display_name(user)}` here = {a.total}")
32 |
--------------------------------------------------------------------------------
/truthdare.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2020 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 |
8 | """
9 | ✘ Commands Available -
10 |
11 | • `{i}truth`
12 | `Get Truth Task.`
13 |
14 | • `{i}dare`
15 | `Get Dare Task.`
16 | """
17 |
18 | import requests as r
19 | from bs4 import BeautifulSoup as bs
20 |
21 | from . import *
22 |
23 | link = "https://fungenerators.com/random/truth-or-dare?option="
24 |
25 |
26 | @ultroid_cmd(pattern="truth$")
27 | async def gtruth(ult):
28 | m = await ult.eor("`Generating a Truth Statement.. `")
29 | nl = link + "truth"
30 | ct = r.get(nl).content
31 | bsc = bs(ct, "html.parser", from_encoding="utf-8")
32 | cm = bsc.find_all("h2")[0].text
33 | await m.edit(f"**#TruthTask**\n\n`{cm}`")
34 |
35 |
36 | @ultroid_cmd(pattern="dare$")
37 | async def gtruth(ult):
38 | m = await ult.eor("`Generating a Dare Task.. `")
39 | nl = link + "dare"
40 | ct = r.get(nl).content
41 | bsc = bs(ct, "html.parser", from_encoding="utf-8")
42 | cm = bsc.find_all("h2")[0].text
43 | await m.edit(f"**#DareTask**\n\n`{cm}`")
44 |
--------------------------------------------------------------------------------
/typing.py:
--------------------------------------------------------------------------------
1 | # (c) Shrimadhav U.K
2 | # aka Spechide
3 | #
4 | # Ported for Ultroid - UserBot
5 | #
6 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
7 | # PLease read the GNU Affero General Public License in
8 | # .
9 |
10 | """
11 | ✘ Commands Available -
12 |
13 | • `{i}type `
14 | Edits the Message and shows like someone is typing.
15 | """
16 |
17 | import asyncio
18 |
19 | from . import *
20 |
21 |
22 | @ultroid_cmd(pattern="type ?(.*)", fullsudo=True)
23 | async def _(event):
24 | input_str = event.pattern_match.group(1)
25 | if not input_str:
26 | return await event.eor("Give me something to type !")
27 | shiiinabot = "\u2060" * 602
28 | okla = await event.eor(shiiinabot)
29 | typing_symbol = "|"
30 | previous_text = ""
31 | await okla.edit(typing_symbol)
32 | await asyncio.sleep(0.4)
33 | for character in input_str:
34 | previous_text = previous_text + "" + character
35 | typing_text = previous_text + "" + typing_symbol
36 | await okla.edit(typing_text)
37 | await asyncio.sleep(0.4)
38 | await okla.edit(previous_text)
39 | await asyncio.sleep(0.4)
40 |
--------------------------------------------------------------------------------
/waifu.py:
--------------------------------------------------------------------------------
1 | # Ported Plugin
2 |
3 | """
4 | ✘ Commands Available -
5 |
6 | • `{i}waifu `
7 | paste text on random stickers.
8 | """
9 |
10 | import re
11 |
12 | from . import *
13 |
14 | EMOJI_PATTERN = re.compile(
15 | "["
16 | "\U0001F1E0-\U0001F1FF" # flags (iOS)
17 | "\U0001F300-\U0001F5FF" # symbols & pictographs
18 | "\U0001F600-\U0001F64F" # emoticons
19 | "\U0001F680-\U0001F6FF" # transport & map symbols
20 | "\U0001F700-\U0001F77F" # alchemical symbols
21 | "\U0001F780-\U0001F7FF" # Geometric Shapes Extended
22 | "\U0001F800-\U0001F8FF" # Supplemental Arrows-C
23 | "\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
24 | "\U0001FA00-\U0001FA6F" # Chess Symbols
25 | "\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
26 | "\U00002702-\U000027B0" # Dingbats
27 | "]+",
28 | )
29 |
30 |
31 | def deEmojify(inputString: str) -> str:
32 | """Remove emojis and other non-safe characters from string"""
33 | return re.sub(EMOJI_PATTERN, "", inputString)
34 |
35 |
36 | @ultroid_cmd(
37 | pattern="waifu ?(.*)",
38 | )
39 | async def waifu(animu):
40 | xx = await eor(animu, get_string("com_1"))
41 | # """Creates random anime sticker!"""
42 | text = animu.pattern_match.group(1)
43 | if not text:
44 | if animu.is_reply:
45 | text = (await animu.get_reply_message()).message
46 | else:
47 | await xx.edit(get_string("sts_1"))
48 | return
49 | waifus = [32, 33, 37, 40, 41, 42, 58, 20]
50 | finalcall = "#" + (str(random.choice(waifus)))
51 | sticcers = await animu.client.inline_query(
52 | "stickerizerbot",
53 | f"{finalcall}{(deEmojify(text))}",
54 | )
55 | await sticcers[0].click(
56 | animu.chat_id,
57 | reply_to=animu.reply_to_msg_id,
58 | silent=bool(animu.is_reply),
59 | hide_via=True,
60 | )
61 | await xx.delete()
62 |
--------------------------------------------------------------------------------
/whichsong.py:
--------------------------------------------------------------------------------
1 | # Ultroid - UserBot
2 | # Copyright (C) 2021-2022 TeamUltroid
3 | #
4 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5 | # PLease read the GNU Affero General Public License in
6 | # .
7 | """
8 | ✘ Commands Available -
9 |
10 | • `{i}whichsong`
11 | Reply to a song file, to recognise the song.
12 | """
13 |
14 | from os import remove
15 |
16 | from shazamio import Shazam
17 |
18 | from . import eor, get_string, mediainfo, ultroid_cmd
19 |
20 | shazam = Shazam()
21 |
22 |
23 | @ultroid_cmd(pattern="whichsong$")
24 | async def song_recog(event):
25 | reply = await event.get_reply_message()
26 | if not (reply and mediainfo(reply.media) == "audio"):
27 | return await event.eor(get_string("whs_1"), time=5)
28 | xx = await event.eor(get_string("com_5"))
29 | path_to_song = "./temp/shaazam_cache/unknown.mp3"
30 | await reply.download_media(path_to_song)
31 | await xx.edit(get_string("whs_2"))
32 | try:
33 | res = await shazam.recognize_song(path_to_song)
34 | except Exception as e:
35 | return await eor(xx, str(e), time=10)
36 | remove(path_to_song)
37 | try:
38 | x = res["track"]
39 | await xx.edit(get_string("whs_4").format(x["title"]))
40 | except KeyError:
41 | return await eor(xx, get_string("whs_3"), time=5)
42 |
--------------------------------------------------------------------------------
/wikipedia.py:
--------------------------------------------------------------------------------
1 | # Ultroid Userbot
2 | #
3 | # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
4 | # PLease read the GNU Affero General Public License in
5 | # .
6 |
7 | """
8 |
9 | ✘ Commands Available -
10 |
11 | • `{i}wiki ``
12 | Wikipedia search from telegram.
13 |
14 | """
15 |
16 | import wikipedia
17 |
18 | from . import *
19 |
20 |
21 | @ultroid_cmd(pattern="wiki ?(.*)")
22 | async def wiki(e):
23 | srch = e.pattern_match.group(1)
24 | if not srch:
25 | return await e.eor("`Give some text to search on wikipedia !`")
26 | msg = await e.eor(f"`Searching {srch} on wikipedia..`")
27 | try:
28 | mk = wikipedia.summary(srch)
29 | te = f"**Search Query :** {srch}\n\n**Results :** {mk}"
30 | await msg.edit(te)
31 | except Exception as err:
32 | await msg.edit(f"**ERROR** : {str(err)}")
33 |
--------------------------------------------------------------------------------
/wreplace.py:
--------------------------------------------------------------------------------
1 | # credits to @Harpia-Vieillot
2 | # For @TeamUltroid
3 | """
4 | ✘ Commands Available
5 |
6 | • `{i}wreplace ;`
7 | Note : Don't use brackets
8 |
9 | Ex. :
10 | `{i}wreplace 10 Hi;Hello`
11 |
12 | Use: It replaces a perticular word by new word (only in your msgs.) In many msgs at a time
13 | """
14 |
15 | import asyncio
16 |
17 | from . import *
18 | from telethon.errors.rpcerrorlist import InlineBotRequiredError
19 |
20 |
21 | @ultroid_cmd(pattern="wreplace")
22 | async def harpia(e):
23 | try:
24 | sed = str(e.text[10:])
25 | lst = sed.split(" ", 1)
26 | lmt = int(lst[0]) + 1
27 | pist = lst[1].split(";")
28 | _ = pist[1]
29 | except IndexError:
30 | return eod(e, f"Check Example : `{HNDLR}help {wreplace}`")
31 | msg = await e.eor("Processing...")
32 | async for x in e.client.iter_messages(
33 | e.chat_id, search=pist[0], limit=lmt, from_user="me"
34 | ):
35 | try:
36 | msg = x.text
37 | m = msg.replace(pist[0], pist[1])
38 | await x.edit(m)
39 | await asyncio.sleep(1)
40 | except InlineBotRequiredError:
41 | pass
42 | await eod(msg, "Finished...")
43 |
--------------------------------------------------------------------------------