UFoP-API / plugins /fontgen.py
Ufoptg's picture
Upload 95 files
156ce57 verified
raw
history blame
2.2 kB
# Ultroid - UserBot
# Copyright (C) 2021-2023 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