Spaces:
Paused
Paused
Captain D. Ezio
commited on
Commit
·
81ceb45
1
Parent(s):
47339b8
Update stickers.py
Browse files- Powers/plugins/stickers.py +5 -22
Powers/plugins/stickers.py
CHANGED
|
@@ -91,28 +91,7 @@ async def kang(c:Gojo, m: Message):
|
|
| 91 |
|
| 92 |
# Get the corresponding fileid, resize the file if necessary
|
| 93 |
try:
|
| 94 |
-
if is_requ or m.reply_to_message.video or m.reply_to_message.photo or (m.reply_to_message.document and m.reply_to_message.document.mime_type.split("/")[0]
|
| 95 |
-
sizee = (await get_file_size(m.reply_to_message)).split()
|
| 96 |
-
if (sizee[1] == "mb" and int(sizee[0]) > 10) or sizee[1] == "gb":
|
| 97 |
-
await m.reply_text("File size is too big")
|
| 98 |
-
return
|
| 99 |
-
path = await m.reply_to_message.download()
|
| 100 |
-
if not is_requ:
|
| 101 |
-
try:
|
| 102 |
-
path = await resize_file_to_sticker_size(path)
|
| 103 |
-
except OSError as e:
|
| 104 |
-
await m.reply_text(f"Error\n{e}")
|
| 105 |
-
LOGGER.error(e)
|
| 106 |
-
LOGGER.error(format_exc)
|
| 107 |
-
os.remove(path)
|
| 108 |
-
return
|
| 109 |
-
except Exception as e:
|
| 110 |
-
await m.reply_text(f"Got an error:\n{e}")
|
| 111 |
-
LOGGER.error(e)
|
| 112 |
-
LOGGER.error(format_exc())
|
| 113 |
-
return
|
| 114 |
-
try:
|
| 115 |
-
if is_requ or m.reply_to_message.animation or m.reply_to_message.video or (m.reply_to_message.document and m.reply_to_message.document.mime_type.split("/")[0] == "video"):
|
| 116 |
# telegram doesn't allow animated and video sticker to be kanged as we do for normal stickers
|
| 117 |
if m.reply_to_message.animation or m.reply_to_message.video or (m.reply_to_message.document and m.reply_to_message.document.mime_type.split("/")[0] == "video"):
|
| 118 |
path = await Vsticker(c, m.reply_to_message)
|
|
@@ -122,6 +101,10 @@ async def kang(c:Gojo, m: Message):
|
|
| 122 |
os.remove(path)
|
| 123 |
return
|
| 124 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
path = await m.reply_to_message.download()
|
| 126 |
path = await resize_file_to_sticker_size(path)
|
| 127 |
sticker = await create_sticker(
|
|
|
|
| 91 |
|
| 92 |
# Get the corresponding fileid, resize the file if necessary
|
| 93 |
try:
|
| 94 |
+
if is_requ or m.reply_to_message.animation or m.reply_to_message.video or m.reply_to_message.photo or (m.reply_to_message.document and m.reply_to_message.document.mime_type.split("/")[0] in ["video","image"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
# telegram doesn't allow animated and video sticker to be kanged as we do for normal stickers
|
| 96 |
if m.reply_to_message.animation or m.reply_to_message.video or (m.reply_to_message.document and m.reply_to_message.document.mime_type.split("/")[0] == "video"):
|
| 97 |
path = await Vsticker(c, m.reply_to_message)
|
|
|
|
| 101 |
os.remove(path)
|
| 102 |
return
|
| 103 |
else:
|
| 104 |
+
sizee = (await get_file_size(m.reply_to_message)).split()
|
| 105 |
+
if (sizee[1] == "mb" and int(sizee[0]) > 10) or sizee[1] == "gb":
|
| 106 |
+
await m.reply_text("File size is too big")
|
| 107 |
+
return
|
| 108 |
path = await m.reply_to_message.download()
|
| 109 |
path = await resize_file_to_sticker_size(path)
|
| 110 |
sticker = await create_sticker(
|