コード例 #1
0
ファイル: mute.py プロジェクト: wonkru-bot/TeleBot
async def endmute(event):
    private = False
    if event.fwd_from:
        return
    elif event.is_private:
        await eor(event, "Unexpected issues or ugly errors may occur!")
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = 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 eor(
            event,
            "Please reply to a user or add their into the command to unmute them.",
        )
    chat_id = event.chat_id
    if not is_muted(userid, chat_id):
        return await eor(event, "This user is not muted in this chat")
    try:
        unmute(userid, chat_id)
    except Exception as e:
        await eor(event, "Error occured!\nError is " + str(e))
    else:
        await eor(event, "Successfully unmuted that person")
コード例 #2
0
async def startgmute(event):
    private = False
    if event.fwd_from:
        return
    elif event.is_private:
        await eor(event, "Unexpected issues or ugly errors may occur!")
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = 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 eor(
            event, "Please reply to a user or add their into the command to gmute them."
        )
    event.chat_id
    await event.get_chat()
    if is_muted(userid, "gmute"):
        return await eor(event, "This user is already gmuted")
    try:
        mute(userid, "gmute")
    except Exception as e:
        await eor(event, "Error occured!\nError is " + str(e))
    else:
        await eor(event, "Silence now. **Successfully gmuted that person**")
コード例 #3
0
async def gmoot(event):
    tele = await eor(event, "`GMuting user...`")
    private = False
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    userid = reply.sender_id
    if userid == OWNER_ID:
        await tele.edit(r"Are you dumb n***a? Why would you mute yourself!!")
        return
    elif event.is_private:
        await tele.edit("Globally muted [user](tg://user?id={})".format(userid)
                        )
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = 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 tele.edit(
            "`Reply to a person or give me his id to GMute!!`")
    event.chat_id
    await event.get_chat()
    if is_muted(userid, "gmute"):
        return await tele.edit(
            "This [user](tg://user?id={}) is already GMuted!!".format(userid))
    try:
        mute(userid, "gmute")
    except Exception as e:
        await tele.edit("**Error**\n" + str(e))
    else:
        await tele.edit(
            "**GMuted!**\nUserID - {}\nLink - [here](tg://user?id={})".format(
                userid, userid))
    try:
        await telebot.send_message(
            Var.PRIVATE_GROUP_ID,
            "#GMute\nUserID - {}\nLink - [here](tg://user?id={})".format(
                userid, userid),
        )
    except BaseException:
        pass
コード例 #4
0
ファイル: mute.py プロジェクト: wonkru-bot/TeleBot
async def startmute(event):
    private = False
    if event.fwd_from:
        return
    elif event.is_private:
        await eor(event, "Unexpected issues or ugly errors may occur!")
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = 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 eor(
            event,
            "Please reply to a user or add their into the command to mute them."
        )
    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(
                event,
                "You can't mute a person if you dont have delete messages permission",
            )
    elif "creator" in vars(chat):
        pass
    elif private:
        pass
    else:
        return await eor(event, "You can't mute a person without admin rights")
    if is_muted(userid, chat_id):
        return await eor(event, "This user is already muted in this chat")
    try:
        mute(userid, chat_id)
    except Exception as e:
        await eor(event, "Error occured!\nError is " + str(e))
    else:
        await eor(event, "Successfully muted that person")
コード例 #5
0
async def endgmute(event):
    private = False
    tele = await eor(event, "`UnGMuting user...`")
    if event.fwd_from:
        return
    elif event.is_private:
        await tele.edit("UnGMuted user")
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = 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 tele.edit(
            "`Reply to a person or give me his id to UnGMute!!`")
    event.chat_id
    if not is_muted(userid, "gmute"):
        return await tele.edit("Hmm.. This person is not GMuted, yet!")
    try:
        unmute(userid, "gmute")
    except Exception as e:
        await tele.edit("**Error**\n" + str(e))
    else:
        await tele.edit(
            "**UnGMuted!**\nUserID - {}\nLink - [here](tg://user?id={})".
            format(userid, userid))
    try:
        await telebot.send_message(
            Var.PRIVATE_GROUP_ID,
            "#UnGMute\nUserID - {}\nLink - [here](tg://user?id={})".format(
                userid, userid),
        )
    except BaseException:
        pass
コード例 #6
0
ファイル: mute.py プロジェクト: wonkru-bot/TeleBot
async def watcher(event):
    if is_muted(event.sender_id, event.chat_id):
        await event.delete()
コード例 #7
0
async def watcher(event):
    if is_muted(event.sender_id, "gmute"):
        await event.delete()