def getAutoReply(text): try: return SESSION.query(AutoReply).filter(AutoReply.text == text).one() except: return None finally: SESSION.close()
def getAllAutoReply(): try: return SESSION.query(AutoReply).all() except: return None finally: SESSION.close()
def getDevsUsers(): try: return SESSION.query(DevUser).all() except: return None finally: SESSION.close()
def getWelcomeSettings(chat_id): try: return SESSION.query(Welcome).filter(Welcome.chat_id == chat_id).one() except: return None finally: SESSION.close()
def getMutedUsers(chat_id): try: return SESSION.query(MutePersonal).filter( MutePersonal.chat_id == chat_id).all() except: return None finally: SESSION.close()
def getDevUser(from_id): try: devUser = SESSION.query(DevUser).filter( DevUser.user_id == from_id).one() SESSION.close() return devUser except: return None
def getPropSettings(chatId): try: return SESSION.query(PropSetting).filter( PropSetting.chatId == chatId).get() except: return None finally: SESSION.close()
def getMutedUser(chat_id, from_id): try: muteUser = (SESSION.query(MutePersonal).filter( MutePersonal.chat_id == chat_id).filter( MutePersonal.user_id == from_id).one()) SESSION.close() return muteUser except: return None
def getPropSetting(chatId, propName): try: return (SESSION.query(PropSetting).filter( PropSetting.chatId == chatId and PropSetting.propName == propName).one()) except: return None finally: SESSION.close()