-
Notifications
You must be signed in to change notification settings - Fork 129
/
spam.py
54 lines (39 loc) · 1.8 KB
/
spam.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Dragon-Userbot - telegram userbot
# Copyright (C) 2020-present Dragon 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",
}