Add auto-clear reactions
This commit is contained in:
		
							parent
							
								
									3d96fe5f89
								
							
						
					
					
						commit
						fa54d641cc
					
				| 
						 | 
				
			
			@ -20,3 +20,4 @@ config:
 | 
			
		|||
    log_reports: true
 | 
			
		||||
    log_forwards: true
 | 
			
		||||
    log_ring_maxlen: 69420
 | 
			
		||||
    auto_clear_reactions: false
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
import asyncio
 | 
			
		||||
from pyrogram import Client, filters
 | 
			
		||||
from pyrogram.raw.functions.messages import ReadReactions
 | 
			
		||||
from .. import config, log_errors
 | 
			
		||||
 | 
			
		||||
# I fucking HATE reactions!
 | 
			
		||||
@Client.on_message(filters.outgoing & filters.edited)
 | 
			
		||||
@log_errors
 | 
			
		||||
async def auto_clear_reactions(client, message):
 | 
			
		||||
    if not config['config'].get('auto_clear_reactions') or not message.reactions:
 | 
			
		||||
        return
 | 
			
		||||
    while True:
 | 
			
		||||
        if (await client.send(ReadReactions(peer=await client.resolve_peer(message.chat.id)))).pts_count > 0:
 | 
			
		||||
            break
 | 
			
		||||
        await asyncio.sleep(1)
 | 
			
		||||
		Loading…
	
		Reference in New Issue