diff --git a/shizuchat/modules/Yre.py b/shizuchat/modules/Yre.py index a59a54d..e116495 100644 --- a/shizuchat/modules/Yre.py +++ b/shizuchat/modules/Yre.py @@ -1,43 +1,52 @@ -import asyncio -from os import remove -from pyrogram import Client, filters -from pyrogram.enums import ChatType -from pyrogram.types import Message -from datetime import datetime -from time import time -from pyrogram.errors import MessageDeleteForbidden, RPCError -from asyncio import sleep -from pyrogram import Client, enums -from pyrogram.types import Message, User -from pyrogram import Client, enums, filters -from pyrogram import Client, enums, filters, raw -from pyrogram.errors.exceptions.bad_request_400 import ChatNotModified -from shizuchat import shizuchat -from pyrogram.types import ChatPermissions, Message -from os import getenv -from dotenv import load_dotenv import random +import asyncio +from shizuchat import shizuchat as app +from pyrogram import filters + + +# Reactions list +reactions = [ + '๐Ÿ‘', '๐Ÿ‘Ž', 'โค๏ธ', '๐Ÿ”ฅ', '๐Ÿฅฐ', '๐Ÿ‘', '๐Ÿ˜', '๐Ÿค”', '๐Ÿคฏ', '๐Ÿ˜ฑ', '๐Ÿคฌ', '๐Ÿ˜ข', '๐ŸŽ‰', '๐Ÿคฉ', '๐Ÿคฎ', '๐Ÿ’ฉ', '๐Ÿ™', '๐Ÿ‘Œ', + '๐Ÿ•Š', '๐Ÿคก', '๐Ÿฅฑ', '๐Ÿฅด', '๐Ÿ˜', '๐Ÿณ', 'โค๏ธโ€๐Ÿ”ฅ', '๐ŸŒš', '๐ŸŒญ', '๐Ÿ’ฏ', '๐Ÿคฃ', 'โšก๏ธ', '๐ŸŒ', '๐Ÿ†', '๐Ÿ’”', '๐Ÿคจ', '๐Ÿ˜', + '๐Ÿ“', '๐Ÿพ', '๐Ÿ’‹', '๐Ÿ–•', '๐Ÿ˜ˆ', '๐Ÿ˜ด', '๐Ÿค“', '๐Ÿ‘ป', '๐Ÿ‘จโ€๐Ÿ’ป', '๐Ÿ‘€', '๐ŸŽƒ', '๐Ÿ™ˆ', '๐Ÿ˜‡', '๐Ÿ˜จ', '๐Ÿค', 'โœ๏ธ', '๐Ÿค—', + '๐Ÿซก', '๐ŸŽ…', '๐ŸŽ„', 'โ˜ƒ๏ธ', '๐Ÿ’…', '๐Ÿคช', '๐Ÿ—ฟ', '๐Ÿ†’', '๐Ÿ’˜', '๐Ÿ™‰', '๐Ÿฆ„', '๐Ÿ˜˜', '๐Ÿ’Š', '๐Ÿ™Š', '๐Ÿ˜Ž', '๐Ÿ‘พ', '๐Ÿคทโ€โ™‚๏ธ', + '๐Ÿคทโ€โ™€๏ธ', '๐Ÿ˜ญ', '๐Ÿคซ', '๐Ÿ’ƒ', '๐Ÿ•บ', '๐Ÿ‘‹', '๐Ÿท', '๐ŸŒน', '๐Ÿ’–', '๐ŸŒˆ', '๐Ÿ–ค', '๐Ÿ˜ก', '๐Ÿ˜ณ', '๐Ÿฅณ', '๐Ÿค–', '๐Ÿฆธ', '๐Ÿฆน', + '๐Ÿง™โ€โ™‚๏ธ', '๐Ÿง™โ€โ™€๏ธ', '๐Ÿงโ€โ™‚๏ธ', '๐Ÿงโ€โ™€๏ธ', '๐Ÿง›โ€โ™‚๏ธ', '๐Ÿง›โ€โ™€๏ธ', '๐ŸงŸโ€โ™‚๏ธ', '๐ŸงŸโ€โ™€๏ธ', '๐Ÿงžโ€โ™‚๏ธ', '๐Ÿงžโ€โ™€๏ธ', '๐Ÿงœโ€โ™‚๏ธ', '๐Ÿงœโ€โ™€๏ธ', + '๐Ÿงšโ€โ™‚๏ธ', '๐Ÿงšโ€โ™€๏ธ', '๐Ÿถ', '๐Ÿฑ', '๐Ÿญ', '๐Ÿน', '๐Ÿฐ', '๐ŸฆŠ', '๐Ÿป', '๐Ÿผ', '๐Ÿปโ€โ„๏ธ', '๐Ÿจ', '๐Ÿฏ', '๐Ÿฆ', '๐Ÿฎ', '๐Ÿท', + '๐Ÿธ', '๐Ÿต', '๐Ÿ™ˆ', '๐Ÿ™‰', '๐Ÿ™Š', '๐Ÿ’', '๐Ÿ”', '๐Ÿง', '๐Ÿฆ', '๐Ÿค', '๐Ÿฃ', '๐Ÿฅ', '๐Ÿฆ†', '๐Ÿฆ…', '๐Ÿฆ‰', '๐Ÿฆœ', '๐Ÿ“', '๐Ÿฆƒ', + '๐Ÿฌ', '๐ŸŸ', '๐Ÿ ', '๐Ÿก', '๐Ÿฆˆ', '๐Ÿ™', '๐Ÿš', '๐ŸŒ', '๐Ÿž', '๐Ÿœ', '๐Ÿฆ‹', '๐Ÿ', '๐Ÿง', '๐Ÿฆ—', '๐Ÿ•ท', '๐Ÿ•ธ', '๐Ÿฆ•', '๐Ÿฆ–', + '๐ŸฆŽ', '๐Ÿข', '๐Ÿ', '๐Ÿฆ‚', '๐ŸฆŸ', '๐Ÿฆ ', '๐Ÿฒ', '๐Ÿ‰', '๐Ÿฆœ', '๐Ÿณ', '๐Ÿ‹', '๐Ÿฌ' +] -CMDS = [" ","sukh"] -@shizuchat.on_message(filters.command(CMDS, prefixes=[""])) -async def handle_incoming_messages(client, message): - reactions = ['๐Ÿ‘','โค๏ธ','๐Ÿ”ฅ','๐Ÿฅฐ','๐Ÿ‘','๐Ÿ˜','๐Ÿคฉ','๐Ÿ‘Œ','๐Ÿฅฑ','๐Ÿ˜','โค๏ธโ€๐Ÿ”ฅ','๐Ÿ’ฏ','๐Ÿคฃ','โšก๏ธ','๐Ÿ˜ด','๐Ÿ‘€','๐Ÿ™ˆ','๐Ÿค','๐Ÿค—','๐Ÿคช','๐Ÿ’˜','๐Ÿ˜˜','๐Ÿ˜Ž'] - if not await react_to_message(client, message, random.choice(reactions)): - print("All positive reactions failed.") - return +# Global variable to track reaction status (default off) +is_reaction_on = False # Make sure this is defined globally -async def react_to_message(client, message, reactions): - for reaction in reactions: - try: - if hasattr(message, 'id'): - await client.send_reaction(message.chat.id, message.id, reactions) - return True - else: - print("Message object does not have id attribute.") - return False - except Exception as e: - print(f"An error occurred: {e}") - continue - return False +@app.on_message(filters.command(["reaction", "react", "eaction", "eact"], prefixes=["/", "!", ".", "R", "r"])) +async def toggle_reaction(client, message): + global is_reaction_on + command_parts = message.text.split() + if len(command_parts) == 2: + if command_parts[1].lower() == "on": + is_reaction_on = True + await message.reply_text("Reaction spam is now ON! ๐Ÿ˜ˆ") + elif command_parts[1].lower() == "off": + is_reaction_on = False + await message.reply_text("Reaction spam is now OFF! ๐Ÿ˜Œ") + else: + await message.reply_text("Invalid command. Use /reaction on or /reaction off") + else: + await message.reply_text("Invalid command. Use /reaction on or /reaction off") +@app.on_message() +async def auto_react(client, message): + global is_reaction_on + if is_reaction_on: + # Check the type of the message and react accordingly + if message.text or message.sticker or message.audio or message.voice or message.video or message.document or message.animation: + reaction = random.choice(reactions) + try: + await message.react(reaction) + await asyncio.sleep(0.01) # Small delay to avoid rate limiting + except Exception as e: + print(f"An error occurred: {e}")