-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathtextformat.py
109 lines (100 loc) · 3.38 KB
/
textformat.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from userbot import catub
from userbot.core.managers import edit_delete, edit_or_reply
plugin_category = "Extra"
@catub.cat_cmd(
pattern="upper(?: |$)([\s\S]*)",
command=("upper", plugin_category),
info={
"header": "Text operation change to upper text",
"usage": "{tr}upper <input text /reply to text>",
"examples": "{tr}upper Reply to valid text or give valid text as input",
},
)
async def some(event):
"""Text Format upper"""
intxt = event.pattern_match.group(1)
reply = await event.get_reply_message()
if not intxt and reply:
intxt = reply.text
if not intxt:
return await edit_delete(
event, "**ಠ∀ಠ Reply to valid text or give text as input...you moron!!**"
)
mystring = intxt.upper()
await edit_or_reply(event, mystring)
@catub.cat_cmd(
pattern="lower(?: |$)([\s\S]*)",
command=("lower", plugin_category),
info={
"header": "Text operation change to lower text",
"usage": "{tr}lower <input text /reply to text>",
"examples": "{tr}lower Reply to valid text or give valid text as input",
},
)
async def good(event):
"""Text Format lower"""
intxt = event.pattern_match.group(1)
reply = await event.get_reply_message()
if not intxt and reply:
intxt = reply.text
if not intxt:
return await edit_delete(
event, "**ಠ∀ಠ Reply to valid text or give text as input...you moron!!**"
)
mystring = intxt.lower()
await edit_or_reply(event, mystring)
@catub.cat_cmd(
pattern="title(?: |$)([\s\S]*)",
command=("title", plugin_category),
info={
"header": "Text operation change to title text",
"usage": "{tr}title<input text /reply to text>",
"examples": "{tr}title Reply to valid text or give valid text as input",
},
)
async def stuff(event):
"""Text Format title"""
intxt = event.pattern_match.group(1)
reply = await event.get_reply_message()
if not intxt and reply:
intxt = reply.text
if not intxt:
return await edit_delete(
event, "**ಠ∀ಠ Reply to valid text or give text as input...you moron!!**"
)
mystring = intxt.title()
await edit_or_reply(event, mystring)
@catub.cat_cmd(
pattern="(|r)camel(?: |$)([\s\S]*)",
command=("camel", plugin_category),
info={
"header": "Text operation change to camel text",
"usage": [
"{tr}camel <input text /reply to text>",
"{tr}rcamel <input text /reply to text>",
],
"examples": [
"{tr}camel Reply to valid text or give valid text as input",
"{tr}rcamel Reply to valid text or give valid text as input",
],
},
)
async def here(event):
"""Text Format camel"""
cmd = event.pattern_match.group(1).lower()
intxt = event.pattern_match.group(2)
reply = await event.get_reply_message()
if not intxt and reply:
intxt = reply.text
if not intxt:
return await edit_delete(
event, "**ಠ∀ಠ Reply to valid text or give text as input...you moron!!**"
)
if cmd == "r":
bad = list(intxt.lower())[::2]
cat = list(intxt.upper())[1::2]
else:
bad = list(intxt.upper())[::2]
cat = list(intxt.lower())[1::2]
mystring = "".join(f"{i}{j}" for i, j in zip(bad, cat))
await edit_or_reply(event, mystring)