def add_welcome_setting(chat_id, custom_welcome_message, should_clean_welcome, previous_welcome, media_file_id): # adder = SESSION.query(Welcome).get(chat_id) adder = Welcome(chat_id, custom_welcome_message, should_clean_welcome, previous_welcome, media_file_id) SESSION.add(adder) SESSION.commit()
def add_note2(chat_id, keyword, reply): adder = SESSION.query(Notes2).get((str(chat_id), keyword)) if adder: adder.reply = reply else: adder = Notes2(str(chat_id), keyword, reply) SESSION.add(adder) SESSION.commit()
def init_locks(chat_id, reset=False): curr_restr = SESSION.query(Locks).get(str(chat_id)) if reset: SESSION.delete(curr_restr) SESSION.flush() restr = Locks(str(chat_id)) SESSION.add(restr) SESSION.commit() return restr
def add_snip(keyword, reply, snip_type, media_id, media_access_hash, media_file_reference): adder = SESSION.query(Snips).get(keyword) if adder: adder.reply = reply adder.snip_type = snip_type adder.media_id = media_id adder.media_access_hash = media_access_hash adder.media_file_reference = media_file_reference else: adder = Snips(keyword, reply, snip_type, media_id, media_access_hash, media_file_reference) SESSION.add(adder) SESSION.commit()
def update_lock(chat_id, lock_type, locked): curr_perm = SESSION.query(Locks).get(str(chat_id)) if not curr_perm: curr_perm = init_locks(chat_id) if lock_type == "bots": curr_perm.bots = locked elif lock_type == "commands": curr_perm.commands = locked elif lock_type == "email": curr_perm.email = locked elif lock_type == "forward": curr_perm.forward = locked elif lock_type == "url": curr_perm.url = locked SESSION.add(curr_perm) SESSION.commit()
def approve(chat_id, reason): adder = PMPermit(str(chat_id), str(reason)) SESSION.add(adder) SESSION.commit()
def mute2(sender, chat_id): adder = Mute2(str(sender), str(chat_id)) SESSION.add(adder) SESSION.commit()
def gmute2(sender): adder = GMute2(str(sender)) SESSION.add(adder) SESSION.commit()