randydev commited on
Commit
3114713
·
verified ·
1 Parent(s): 433c829

Update Akeno/plugins/emojiprem.py

Browse files
Files changed (1) hide show
  1. Akeno/plugins/emojiprem.py +17 -10
Akeno/plugins/emojiprem.py CHANGED
@@ -4,6 +4,7 @@ from pyrogram import Client as ren
4
  from pyrogram import Client, filters
5
  from pyrogram import *
6
  from pyrogram.types import *
 
7
  from Akeno.utils.handler import *
8
  from config import *
9
 
@@ -39,22 +40,28 @@ async def set_emoji_status(client: Client, message: Message):
39
  if not text_get:
40
  await message.reply_text(f"Example ?setpemoji {custom_verifed}")
41
  return
42
- get_custom_emoji_id = message.text_get.entities[0].custom_emoji_id.strip()
43
- only_premium = await client.get_users("me")
44
- if only_premium.is_premium:
 
 
 
 
 
 
 
 
 
45
  try:
46
  await client.set_emoji_status(
47
- EmojiStatus(
48
- custom_emoji_id=get_custom_emoji_id
49
- )
50
  )
51
- await message.reply_text(f"Successfully profile change emoji status <emoji id={get_custom_emoji_id}>🗿</emoji>")
52
  except Exception as e:
53
  await message.reply_text(str(e))
54
- return
55
  else:
56
- await message.reply_text("can't non-premium user")
57
-
58
  @Akeno(
59
  ~filters.scheduled
60
  & filters.command(["stealpemoji"], CMD_HANDLER)
 
4
  from pyrogram import Client, filters
5
  from pyrogram import *
6
  from pyrogram.types import *
7
+ from pyrogram.enums import MessageEntityType
8
  from Akeno.utils.handler import *
9
  from config import *
10
 
 
40
  if not text_get:
41
  await message.reply_text(f"Example ?setpemoji {custom_verifed}")
42
  return
43
+ if not message.entities:
44
+ await message.reply_text("No custom emoji found in the message.")
45
+ return
46
+ get_custom_emoji_id = None
47
+ for entity in message.entities:
48
+ if entity.type == MessageEntityType.CUSTOM_EMOJI:
49
+ get_custom_emoji_id = entity.custom_emoji_id
50
+ break
51
+ if not get_custom_emoji_id:
52
+ await message.reply_text("No custom emoji found in the message.")
53
+ return
54
+ if client.me.is_premium:
55
  try:
56
  await client.set_emoji_status(
57
+ EmojiStatus(custom_emoji_id=get_custom_emoji_id)
 
 
58
  )
59
+ await message.reply_text(f"Successfully changed profile emoji status to <emoji id={get_custom_emoji_id}>🗿</emoji>")
60
  except Exception as e:
61
  await message.reply_text(str(e))
 
62
  else:
63
+ await message.reply_text("Non-premium users cannot set custom emojis.")
64
+
65
  @Akeno(
66
  ~filters.scheduled
67
  & filters.command(["stealpemoji"], CMD_HANDLER)