Files
Ultroid-fork/plugins/fontgen.py
Devesh Pal 0afa1ade15 AI wrapper and twitter plugin (#465)
* Ultroid 2025

Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com>
Co-authored-by: Amit Sharma <buddhhu@users.noreply.github.com>
Co-authored-by: TechiError <techierror@users.noreply.github.com>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com>
Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com>
Co-authored-by: sppidy <sppidy@users.noreply.github.com>
2025-02-21 23:05:48 +05:30

61 lines
2.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Ultroid - UserBot
# Copyright (C) 2021-2025 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/>.
from . import get_help
__doc__ = get_help("help_fontgen")
import string
from . import 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()
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