Spaces:
Running
Running
File size: 2,203 Bytes
156ce57 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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
|