Beispiel #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)}`")
Beispiel #2
0
async def startmute(event):
    xx = await eor(event, "`Muting...`")
    private = False
    if event.is_private:
        private = True
    if event.pattern_match.group(1):
        userid = int(event.pattern_match.group(1))
    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 == True:
        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)}`")
Beispiel #3
0
async def startmute(event):
    xx = await eor(event, "`Muting...`")
    input = event.pattern_match.group(1)
    private = bool(event.is_private)
    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:
        userid = event.chat_id
    else:
        return await eor(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 not True:
            return await eor(xx, "`No proper admin rights...`", time=5)
    elif "creator" not in vars(chat) and not private:
        return await eor(xx, "`No proper admin rights...`", time=5)
    if is_muted(chat_id, userid):
        return await eor(xx,
                         "`This user is already muted in this chat.`",
                         time=5)
    try:
        mute(chat_id, userid)
        await eor(xx, "`Successfully muted...`", time=3)
    except Exception as e:
        await eor(xx, "Error: " + f"`{e}`", time=5)
Beispiel #4
0
async def endmute(event):
    xx = await eor(event, "`Unmuting...`")
    private = False
    if event.is_private:
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1):
        userid = int(event.pattern_match.group(1))
    elif reply is not None:
        userid = reply.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)}`")
Beispiel #5
0
async def watcher(event):
    if is_muted(f"{event.sender_id}_{event.chat_id}"):
        await event.delete()
    if event.via_bot and is_muted(f"{event.via_bot_id}_{event.chat_id}"):
        await event.delete()