-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e720d9
commit 232e56c
Showing
1 changed file
with
47 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}") |