Co-Authored-By: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-Authored-By: MMETMA <79155572+MMETMA@users.noreply.github.com> Co-Authored-By: Aditya <me@xditya.me> Co-Authored-By: marat2509 <93652988+marat2509@users.noreply.github.com> Co-Authored-By: smartman_ru <14003491+smartmanru@users.noreply.github.com> Co-Authored-By: Flasho <75789819+flashokillerify@users.noreply.github.com> Co-Authored-By: ÁÑÑÍHÌLÅTØR SPÄRK <75305464+annihilatorrrr@users.noreply.github.com>
65 lines
2.3 KiB
Python
65 lines
2.3 KiB
Python
# Ultroid - UserBot
|
||
# Copyright (C) 2021-2022 TeamUltroid
|
||
#
|
||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||
# PLease read the GNU Affero General Public License in
|
||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||
"""
|
||
• `{i}font <font name> : <text>`
|
||
Generate different fonts for the text.
|
||
|
||
• `{i}font`
|
||
To get list of fonts
|
||
"""
|
||
|
||
import string
|
||
|
||
from . import HNDLR, eod, ultroid_cmd
|
||
|
||
_default = string.ascii_letters
|
||
Fonts = {
|
||
"small caps": "ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘϙʀsᴛᴜᴠᴡxʏᴢABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||
"monospace": "𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉",
|
||
"double stroke": "𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ",
|
||
"script royal": "𝒶𝒷𝒸𝒹𝑒𝒻𝑔𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝑜𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵",
|
||
}
|
||
|
||
|
||
@ultroid_cmd(
|
||
pattern="font( (.*)|$)",
|
||
)
|
||
async def _(e):
|
||
input = e.pattern_match.group(1).strip()
|
||
reply = await e.get_reply_message()
|
||
help = __doc__.format(i=HNDLR)
|
||
if not input:
|
||
m = "**Available Fonts**\n\n"
|
||
for x in Fonts.keys():
|
||
m += f"• `{x}`\n"
|
||
return await e.eor(m, time=5)
|
||
if not reply:
|
||
try:
|
||
_ = input.split(":", maxsplit=1)
|
||
font = _[0][:-1]
|
||
text = _[1]
|
||
except IndexError:
|
||
return await eod(e, help)
|
||
elif not input:
|
||
return await eod(e, "`Give font dude :/`")
|
||
else:
|
||
font = input
|
||
text = reply.message
|
||
if font not in Fonts.keys():
|
||
return await e.eor(f"`{font} not in font list`.", time=5)
|
||
msg = gen_font(text, Fonts[font])
|
||
await e.eor(msg)
|
||
|
||
|
||
def gen_font(text, new_font):
|
||
new_font = " ".join(new_font).split()
|
||
for q in text:
|
||
if q in _default:
|
||
new = new_font[_default.index(q)]
|
||
text = text.replace(q, new)
|
||
return text
|