Exemplo n.º 1
0
async def linkchat_status(client, message):
    _, chat, new_status = message.data.split()
    chat = int(chat)
    new_status = strtobool(new_status)

    change_configs(chat, "link_optin", new_status)
    configs = get_configs(chat)

    kb = InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton("🛎 Notificar", callback_data="notify_help")
    ] + [
        InlineKeyboardButton(
            get_switch(configs["notifications_optin"]),
            callback_data=
            f"notify_status {chat} {not configs['notifications_optin']}")
    ], [
        InlineKeyboardButton("🔗 Linkar grupo", callback_data="linkchat_help")
    ] + [
        InlineKeyboardButton(
            get_switch(configs["link_optin"]),
            callback_data=f"linkchat_status {chat} {not configs['link_optin']}"
        )
    ]])

    await message.message.edit_text("Painel de controle para o grupo " +
                                    configs["title"],
                                    reply_markup=kb)
Exemplo n.º 2
0
async def banchat(client, message):
    m = await message.reply_text(f"Desbanindo o chat {message.command[1]}...")
    try:
        chat = int(message.command[1])
    except ValueError:
        chat = message.command[1]

    try:
        chat = await client.get_chat(chat)
    except Exception as e:
        await m.edit_text(str(e))
    else:
        change_configs(chat.id, "is_banned", False)
        await m.edit_text(f"Chat {chat.title} (`{chat.id}`) desbanido com sucesso.")
Exemplo n.º 3
0
async def banchat(client, message):
    m = await message.reply_text(f"Banindo o chat {message.command[1]}...")
    try:
        chat = int(message.command[1])
    except ValueError:
        chat = message.command[1]

    try:
        chat = await client.get_chat(chat)
    except Exception as e:
        await m.edit_text(str(e))
    else:
        change_configs(chat.id, "is_banned", True)
        await m.edit_text(
            f"Chat {chat.title} (`{chat.id}`) banido com sucesso. Seus pontos não irão ser contados mais e não serão exibidos nos trendings."
        )