-
Notifications
You must be signed in to change notification settings - Fork 1
/
shuffle.py
40 lines (36 loc) · 1.06 KB
/
shuffle.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
import random
from pyrogram import filters
from pyrogram.types import Message
from strings.filters import command
from config import BANNED_USERS
from strings import get_command
from AnonX import app
from AnonX.misc import db
from AnonX.utils.decorators import AdminRightsCheck
# Commands
SHUFFLE_COMMAND = get_command("SHUFFLE_COMMAND")
@app.on_message(
command(SHUFFLE_COMMAND)
& filters.group
& ~BANNED_USERS
)
@AdminRightsCheck
async def admins(Client, message: Message, _, chat_id):
if not len(message.command) == 1:
return await message.reply_text(_["general_2"])
check = db.get(chat_id)
if not check:
return await message.reply_text(_["admin_21"])
try:
popped = check.pop(0)
except:
return await message.reply_text(_["admin_22"])
check = db.get(chat_id)
if not check:
check.insert(0, popped)
return await message.reply_text(_["admin_22"])
random.shuffle(check)
check.insert(0, popped)
await message.reply_text(
_["admin_23"].format(message.from_user.first_name)
)