Spaces:
Running
Running
File size: 1,883 Bytes
fefc4fb |
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 |
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
@ultroid_cmd(pattern="autoreact( (.*)|$)")
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")
|