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 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)}`")