Team Ai
Apppublic

azils3/bash

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
fontgen.py61 linesDownload Raw Back to plugins
1# Ultroid - UserBot2# Copyright (C) 2021-2025 TeamUltroid3#4# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >5# PLease read the GNU Affero General Public License in6# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.7 8from . import get_help9 10__doc__ = get_help("help_fontgen")11 12import string13 14from . import eod, ultroid_cmd15 16_default = string.ascii_letters17Fonts = {18    "small caps": "ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘϙʀsᴛᴜᴠᴡxʏᴢABCDEFGHIJKLMNOPQRSTUVWXYZ",19    "monospace": "𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉",20    "double stroke": "𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ",21    "script royal": "𝒶𝒷𝒸𝒹𝑒𝒻𝑔𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝑜𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵",22}23 24 25@ultroid_cmd(26    pattern="font( (.*)|$)",27)28async def _(e):29    input = e.pattern_match.group(1).strip()30    reply = await e.get_reply_message()31    if not input:32        m = "**Available Fonts**\n\n"33        for x in Fonts.keys():34            m += f"• `{x}`\n"35        return await e.eor(m, time=5)36    if not reply:37        try:38            _ = input.split(":", maxsplit=1)39            font = _[0][:-1]40            text = _[1]41        except IndexError:42            return await eod(e, help)43    elif not input:44        return await eod(e, "`Give font dude :/`")45    else:46        font = input47        text = reply.message48    if font not in Fonts.keys():49        return await e.eor(f"`{font} not in font list`.", time=5)50    msg = gen_font(text, Fonts[font])51    await e.eor(msg)52 53 54def gen_font(text, new_font):55    new_font = " ".join(new_font).split()56    for q in text:57        if q in _default:58            new = new_font[_default.index(q)]59            text = text.replace(q, new)60    return text61