Spaces:
Running
Running
| # 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": "๐ถ๐ท๐ธ๐น๐๐ป๐๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐โฌ๐๐โฐโฑ๐ขโโ๐ฅ๐ฆโโณ๐ฉ๐ช๐ซ๐ฌโ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต", | |
| } | |
| 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 | |