示例#1
0
async def endmute(event):
    xx = await eor(event, "`Unmuting...`")
    private = False
    input = event.pattern_match.group(1)
    if event.is_private:
        private = True
    if input:
        if input.isdigit():
            try:
                userid = input
            except ValueError as x:
                return await xx.edit(str(x))
        else:
            userid = (await event.client.get_entity(input)).id
    elif event.reply_to_msg_id:
        userid = (await event.get_reply_message()).sender_id
    elif private is True:
        userid = event.chat_id
    else:
        return await eod(xx, "`Reply to a user or add their userid.`", time=5)
    chat_id = event.chat_id
    if not is_muted(f"{userid}_{chat_id}"):
        return await eod(xx, "`This user is not muted in this chat.`", time=3)
    try:
        unmute(f"{userid}_{chat_id}")
        await eod(xx, "`Successfully unmuted...`", time=3)
    except Exception as e:
        await eod(xx, "Error: " + f"`{str(e)}`")
示例#2
0
async def startmute(event):
    xx = await eor(event, "`Muting...`")
    input = event.pattern_match.group(1)
    private = False
    if event.is_private:
        private = True
    if input:
        if input.isdigit():
            try:
                userid = input
            except ValueError as x:
                return await xx.edit(str(x))
        else:
            userid = (await event.client.get_entity(input)).id
    elif event.reply_to_msg_id:
        userid = (await event.get_reply_message()).sender_id
    elif private is True:
        userid = event.chat_id
    else:
        return await eod(xx, "`Reply to a user or add their userid.`", time=5)
    chat_id = event.chat_id
    chat = await event.get_chat()
    if "admin_rights" in vars(chat) and vars(chat)["admin_rights"] is not None:
        if chat.admin_rights.delete_messages is True:
            pass
        else:
            return await eor(xx, "`No proper admin rights...`", time=5)
    elif "creator" in vars(chat):
        pass
    elif private:
        pass
    else:
        return await eod(xx, "`No proper admin rights...`", time=5)
    if is_muted(f"{userid}_{chat_id}"):
        return await eod(xx,
                         "`This user is already muted in this chat.`",
                         time=5)
    try:
        mute(f"{userid}_{chat_id}")
        await eod(xx, "`Successfully muted...`", time=3)
    except Exception as e:
        await eod(xx, "Error: " + f"`{str(e)}`")
示例#3
0
async def watcher(event):
    if is_muted(f"{event.sender_id}_{event.chat_id}"):
        await event.delete()