Files
homelab/modules/spam.py
T
forust 3eaef5dc90 Squashed 'userbot/' content from commit 7fb0a0e
git-subtree-dir: userbot
git-subtree-split: 7fb0a0e179
2026-06-19 23:20:23 +02:00

54 lines
1.8 KiB
Python

# 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 <https://www.gnu.org/licenses/>.
import asyncio
from pyrogram import Client, filters
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)
else:
sent = await client.send_message(message.chat.id, text)
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',
}