# Moon-Userbot - telegram userbot # Copyright (C) 2020-present Moon Userbot Organization # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . import asyncio from pyrogram import Client, filters, enums from pyrogram.types import Message from utils.misc import modules_help, prefix commands = ["spam", "statspam", "slowspam", "fastspam"] @Client.on_message(filters.command(commands, prefix) & filters.me) async def spam(client: Client, message: Message): amount = int(message.command[1]) text = " ".join(message.command[2:]) cooldown = {"spam": 0.15, "statspam": 0.1, "slowspam": 0.9, "fastspam": 0} await message.delete() for msg in range(amount): if message.reply_to_message: sent = await message.reply_to_message.reply(text, parse_mode=enums.ParseMode.HTML) else: sent = await client.send_message(message.chat.id, text, parse_mode=enums.ParseMode.HTML) if message.command[0] == "statspam": await asyncio.sleep(0.1) await sent.delete() await asyncio.sleep(cooldown[message.command[0]]) modules_help["spam"] = { "spam [amount] [text]": "Start spam", "statspam [amount] [text]": "Send and delete", "fastspam [amount] [text]": "Start fast spam", "slowspam [amount] [text]": "Start slow spam", }