Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Co-authored-by: Aditya <xditya@ultroid.tech> Co-authored-by: CyrusXD <79554993+Ashutosh1478@users.noreply.github.com>
234 lines
4.9 KiB
Python
234 lines
4.9 KiB
Python
# Ultroid - UserBot
|
|
# Copyright (C) 2021-2022 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/>.
|
|
"""
|
|
✘ Commands Available -
|
|
|
|
• `{i}carbon <text/reply to msg/reply to document>`
|
|
Carbonise the text with default settings.
|
|
|
|
• `{i}rcarbon <text/reply to msg/reply to document>`
|
|
Carbonise the text, with random bg colours.
|
|
|
|
• `{i}ccarbon <color ><text/reply to msg/reply to document>`
|
|
Carbonise the text, with custom bg colours.
|
|
"""
|
|
import random
|
|
|
|
from . import Carbon, eor, get_string, inline_mention, os, ultroid_cmd
|
|
|
|
all_col = [
|
|
"Black",
|
|
"Navy",
|
|
"DarkBlue",
|
|
"MediumBlue",
|
|
"Blue",
|
|
"DarkGreen",
|
|
"Green",
|
|
"Teal",
|
|
"DarkCyan",
|
|
"DeepSkyBlue",
|
|
"DarkTurquoise",
|
|
"MediumSpringGreen",
|
|
"Lime",
|
|
"SpringGreen",
|
|
"Aqua",
|
|
"Cyan",
|
|
"MidnightBlue",
|
|
"DodgerBlue",
|
|
"LightSeaGreen",
|
|
"ForestGreen",
|
|
"SeaGreen",
|
|
"DarkSlateGray",
|
|
"DarkSlateGrey",
|
|
"LimeGreen",
|
|
"MediumSeaGreen",
|
|
"Turquoise",
|
|
"RoyalBlue",
|
|
"SteelBlue",
|
|
"DarkSlateBlue",
|
|
"MediumTurquoise",
|
|
"Indigo ",
|
|
"DarkOliveGreen",
|
|
"CadetBlue",
|
|
"CornflowerBlue",
|
|
"RebeccaPurple",
|
|
"MediumAquaMarine",
|
|
"DimGray",
|
|
"DimGrey",
|
|
"SlateBlue",
|
|
"OliveDrab",
|
|
"SlateGray",
|
|
"SlateGrey",
|
|
"LightSlateGray",
|
|
"LightSlateGrey",
|
|
"MediumSlateBlue",
|
|
"LawnGreen",
|
|
"Chartreuse",
|
|
"Aquamarine",
|
|
"Maroon",
|
|
"Purple",
|
|
"Olive",
|
|
"Gray",
|
|
"Grey",
|
|
"SkyBlue",
|
|
"LightSkyBlue",
|
|
"BlueViolet",
|
|
"DarkRed",
|
|
"DarkMagenta",
|
|
"SaddleBrown",
|
|
"DarkSeaGreen",
|
|
"LightGreen",
|
|
"MediumPurple",
|
|
"DarkViolet",
|
|
"PaleGreen",
|
|
"DarkOrchid",
|
|
"YellowGreen",
|
|
"Sienna",
|
|
"Brown",
|
|
"DarkGray",
|
|
"DarkGrey",
|
|
"LightBlue",
|
|
"GreenYellow",
|
|
"PaleTurquoise",
|
|
"LightSteelBlue",
|
|
"PowderBlue",
|
|
"FireBrick",
|
|
"DarkGoldenRod",
|
|
"MediumOrchid",
|
|
"RosyBrown",
|
|
"DarkKhaki",
|
|
"Silver",
|
|
"MediumVioletRed",
|
|
"IndianRed ",
|
|
"Peru",
|
|
"Chocolate",
|
|
"Tan",
|
|
"LightGray",
|
|
"LightGrey",
|
|
"Thistle",
|
|
"Orchid",
|
|
"GoldenRod",
|
|
"PaleVioletRed",
|
|
"Crimson",
|
|
"Gainsboro",
|
|
"Plum",
|
|
"BurlyWood",
|
|
"LightCyan",
|
|
"Lavender",
|
|
"DarkSalmon",
|
|
"Violet",
|
|
"PaleGoldenRod",
|
|
"LightCoral",
|
|
"Khaki",
|
|
"AliceBlue",
|
|
"HoneyDew",
|
|
"Azure",
|
|
"SandyBrown",
|
|
"Wheat",
|
|
"Beige",
|
|
"WhiteSmoke",
|
|
"MintCream",
|
|
"GhostWhite",
|
|
"Salmon",
|
|
"AntiqueWhite",
|
|
"Linen",
|
|
"LightGoldenRodYellow",
|
|
"OldLace",
|
|
"Red",
|
|
"Fuchsia",
|
|
"Magenta",
|
|
"DeepPink",
|
|
"OrangeRed",
|
|
"Tomato",
|
|
"HotPink",
|
|
"Coral",
|
|
"DarkOrange",
|
|
"LightSalmon",
|
|
"Orange",
|
|
"LightPink",
|
|
"Pink",
|
|
"Gold",
|
|
"PeachPuff",
|
|
"NavajoWhite",
|
|
"Moccasin",
|
|
"Bisque",
|
|
"MistyRose",
|
|
"BlanchedAlmond",
|
|
"PapayaWhip",
|
|
"LavenderBlush",
|
|
"SeaShell",
|
|
"Cornsilk",
|
|
"LemonChiffon",
|
|
"FloralWhite",
|
|
"Snow",
|
|
"Yellow",
|
|
"LightYellow",
|
|
"Ivory",
|
|
"White",
|
|
]
|
|
|
|
|
|
@ultroid_cmd(
|
|
pattern="(rc|c)arbon",
|
|
)
|
|
async def crbn(event):
|
|
xxxx = await event.eor(get_string("com_1"))
|
|
te = event.text
|
|
col = random.choice(all_col) if te[1] == "r" else "White"
|
|
if event.reply_to_msg_id:
|
|
temp = await event.get_reply_message()
|
|
if temp.media:
|
|
b = await event.client.download_media(temp)
|
|
with open(b) as a:
|
|
code = a.read()
|
|
os.remove(b)
|
|
else:
|
|
code = temp.message
|
|
else:
|
|
try:
|
|
code = event.text.split(" ", maxsplit=1)[1]
|
|
except IndexError:
|
|
return await eor(xxxx, get_string("carbon_2"))
|
|
xx = await Carbon(code=code, file_name="ultroid_carbon", backgroundColor=col)
|
|
await xxxx.delete()
|
|
await event.reply(
|
|
f"Carbonised by {inline_mention(event.sender)}",
|
|
file=xx,
|
|
)
|
|
|
|
|
|
@ultroid_cmd(
|
|
pattern="ccarbon( (.*)|$)",
|
|
)
|
|
async def crbn(event):
|
|
match = event.pattern_match.group(1).strip()
|
|
if not match:
|
|
return await event.eor(get_string("carbon_3"))
|
|
msg = await event.eor(get_string("com_1"))
|
|
if event.reply_to_msg_id:
|
|
temp = await event.get_reply_message()
|
|
if temp.media:
|
|
b = await event.client.download_media(temp)
|
|
with open(b) as a:
|
|
code = a.read()
|
|
os.remove(b)
|
|
else:
|
|
code = temp.message
|
|
else:
|
|
try:
|
|
match = match.split(" ", maxsplit=1)
|
|
code = match[1]
|
|
match = match[0]
|
|
except IndexError:
|
|
return await eor(msg, get_string("carbon_2"))
|
|
xx = await Carbon(code=code, backgroundColor=match)
|
|
await msg.delete()
|
|
await event.reply(
|
|
f"Carbonised by {inline_mention(event.sender)}",
|
|
file=xx,
|
|
)
|