Spaces:
Running
Running
from random import choice | |
from telethon.events import NewMessage | |
from telethon.tl.types import ReactionEmoji | |
from . import ultroid_bot, ultroid_cmd | |
EMO = ('๐ฅฑ', '๐คช', '๐', '๐', '๐ฆ', '๐ณ', '๐', '๐', '๐', 'โค๏ธโ๐ฅ', '๐ญ', 'โค๏ธ', '๐ค', '๐', '๐ฅด', '๐ฉ', '๐', '๐พ', '๐จโ๐ป', '๐', '๐', '๐', '๐', '๐ฅ', '๐', '๐คฌ', '๐', '๐ด', '๐คท', '๐', '๐ค', '๐', '๐ก', '๐คก', '๐', '๐', '๐ค', 'โ๏ธ', '๐', '๐ญ', '๐คฎ', 'โ๏ธ', '๐', '๐', '๐ป', '๐', '๐ค', '๐ฏ', '๐ข', '๐ฑ', '๐คฏ', '๐คจ', '๐', '๐จ', 'โก๏ธ', '๐', '๐ซก', '๐คฉ', '๐ฅฐ', '๐พ', '๐', '๐', '๐ ', '๐', '๐', '๐', '๐คฃ', '๐ฟ', '๐ ', '๐', '๐', '๐คทโโ๏ธ', '๐คท', '๐คทโโ๏ธ') | |
async def autoreact(e): | |
try: | |
emoji = choice(EMO) | |
await e.react([ReactionEmoji(emoji)]) | |
except Exception: | |
pass | |
def autoreact_status(): | |
for func, _ in ultroid_bot.list_event_handlers(): | |
if func == autoreact: | |
return True | |
async def self_react(e): | |
args = e.pattern_match.group(2) | |
eris = await e.eor("...") | |
if args == "on": | |
if autoreact_status(): | |
return await eris.edit("AutoReact is Already Enabled..") | |
ultroid_bot.add_event_handler( | |
autoreact, | |
NewMessage(chats=e.chat_id, | |
outgoing=True, | |
func=lambda e: not (e.fwd_from or e.via_bot), | |
) | |
) | |
await eris.edit("AutoReact Enabled!") | |
elif args == "off": | |
if not autoreact_status(): | |
return await eris.edit("AutoReact is Already Disabled..") | |
ultroid_bot.remove_event_handler(autoreact) | |
await eris.edit("AutoReact Disabled!") | |
else: | |
await eris.edit("Usage: .autoreact on/off") | |