def kread(chat): if SESSION.query(KRead).get((str(chat))): return False adder = KRead(str(chat)) SESSION.add(adder) SESSION.commit() return True
def add_note(chat_id, keyword, reply, f_mesg_id): to_check = get_note(chat_id, keyword) if not to_check: adder = Notes(str(chat_id), keyword, reply, f_mesg_id) SESSION.add(adder) SESSION.commit() return True else: rem = SESSION.query(Notes).get((str(chat_id), keyword)) SESSION.delete(rem) SESSION.commit() adder = Notes(str(chat_id), keyword, reply, f_mesg_id) SESSION.add(adder) SESSION.commit() return False
def add_snip(keyword, reply, f_mesg_id): to_check = get_snip(keyword) if not to_check: adder = Snips(keyword, reply, f_mesg_id) SESSION.add(adder) SESSION.commit() return True else: rem = SESSION.query(Snips).filter(Snips.snip == keyword) rem.delete() SESSION.commit() adder = Snips(keyword, reply, f_mesg_id) SESSION.add(adder) SESSION.commit() return False
def approve(chat_id): adder = PMPermit(str(chat_id)) SESSION.add(adder) SESSION.commit()
def mute(chat_id, sender): adder = Mute(str(chat_id), str(sender)) SESSION.add(adder) SESSION.commit()
def gmute(sender): adder = GMute(str(sender)) SESSION.add(adder) SESSION.commit()
def gban(sender): adder = GBan(str(sender)) SESSION.add(adder) SESSION.commit()