Ejemplo n.º 1
0
async def _s(event):
    user, reason = await get_user_from_event(event)
    sed = await friday.get_permissions(event.chat_id, user.id)
    if sed.is_admin:
        await event.edit("`Demn, Admins Can't Be Warned`")
        return
    dragon = await friday.get_permissions(event.chat_id, bot.uid)
    if not dragon.is_admin:
        await event.edit("`Demn, Me nOT Admin`")
        return
    limit, soft_warn = sql.get_warn_setting(event.chat_id)
    num_warns, reasons = sql.warn_user(user.id, event.chat_id, reason)
    if num_warns >= limit:
        sql.reset_warns(user.id, event.chat_id)
        if soft_warn:
            await friday.kick_participant(event.chat_id, user.id)
            reply = "{} warnings, {} has been kicked!".format(limit, user.id)
            await event.edit(reply)
        else:
            await friday.edit_permissions(event.chat_id, user.id, view_messages=False)
            reply = "{} warnings, {} has been banned!".format(
                limit, user.id, user.first_name
            )
            await event.edit(reply)
        for warn_reason in reasons:
            reply += "\n - {}".format(warn_reason)
    else:
        reply = "{} has {}/{} warnings... watch out!".format(user.id, num_warns, limit)
        if reason:
            reply += "\nReason for last warn:\n{}".format(reason)
        await event.edit(reply)
Ejemplo n.º 2
0
async def _(event):
    user, reason = await get_user_from_event(event)
    sed = await friday.get_permissions(event.chat_id, user.id)
    if sed.is_admin:
        await event.edit("Demn, Admins Can't Be Warned")
        return
    dragon = await friday.get_permissions(event.chat_id, bot.uid)
    if not dragon.is_admin:
        await event.edit("Demn, Me nOT Admin")
        return
    sql.reset_warns(user.id, event.chat_id)
    await event.edit("Warnings have been reset!")
Ejemplo n.º 3
0
async def _(event):
    if event.fwd_from:
        return
    if not event.is_group:
        await event.edit("This Command is Meant To Be Used in Chats/Groups")
        return
    user, reason = await get_user_from_event(event)
    sed = await friday.get_permissions(event.chat_id, user.id)
    if sed.is_admin:
        await event.edit("Demn, Admins Can't Be Warned")
        return
    dragon = await friday.get_permissions(event.chat_id, bot.uid)
    if not dragon.is_admin:
        await event.edit("Demn, Me nOT Admin")
        return
    sql.reset_warns(user.id, event.chat_id)
    await event.edit("Warnings have been reset!")