-
Notifications
You must be signed in to change notification settings - Fork 1
/
figlet.py
49 lines (45 loc) · 1.38 KB
/
figlet.py
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
import pyfiglet
from . import *
@bot.on(d3vil_cmd(pattern="figlet ?(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="figlet ?(.*)", allow_sudo=True))
async def figlet(event):
if event.fwd_from:
return
CMD_FIG = {
"slant": "slant",
"3D": "3-d",
"5line": "5lineoblique",
"alpha": "alphabet",
"banner": "banner3-D",
"doh": "doh",
"iso": "isometric1",
"letter": "letters",
"allig": "alligator",
"dotm": "dotmatrix",
"bubble": "bubble",
"bulb": "bulbhead",
"digi": "digital",
}
input_str = event.pattern_match.group(1)
if ":" in input_str:
text, cmd = input_str.split(":", maxsplit=1)
elif input_str is not None:
cmd = None
text = input_str
else:
await eod(event, "Please add some text to figlet")
return
if cmd is not None:
cmd = cmd.strip()
try:
font = CMD_FIG[cmd]
except KeyError:
await eod(event, "Invalid selected font.")
return
result = pyfiglet.figlet_format(text, font=font)
else:
result = pyfiglet.figlet_format(text)
await eor(event, "`{}`".format(result))
CmdHelp("figlet").add_command(
"figlet", "text : type", "The types are slant, 3D, 5line, alpha, banner, doh, iso, letter, allig, dotm, bubble, bulb, digi"
).add()