Ejemplo n.º 1
0
def updateChatId(e, cid):
    if e.args[0].find('Bad Request: group chat was upgraded to a supergroup chat') != -1:
        import json as js

        d = js.loads(str(e.args[0].split('\n')[1][3:-2]))
        newCid = d['parameters']['migrate_to_chat_id']

        print('!!! CHAT WITH CHAT_ID {} MOVED TO CHAT_ID {} !!!'.format(cid, newCid))

        cfg.bot.send_message(newCid, cfg.group_to_supergroup_text)

        if not(db.boolean_select(db.check_if_settings_exist_text, [cid])):
            db.sql_exec(db.ins_settings_copy_text, [newCid, cid])
            cfg.settings[newCid] = cfg.settings[cid].copy()
            cfg.show_din_time[newCid] = cfg.show_din_time[cid]

        db.delete_from_chatID(cid)

        return newCid
Ejemplo n.º 2
0
def admin_unsubscribe_chat(message):
    cid = message.chat.id
    db.delete_from_chatID(cid)
    bot.send_message(cid, cfg.unsubscribe_msg_chatId)