def get_user_identity_by_name(self, user, name: str): self.cursor.execute( "SELECT * FROM Identities WHERE user_id = ? AND name = ?", (user.id, name)) data = self.cursor.fetchone() return map_rows(data, Identity)
def get_enforcement(self, user, guild): self.cursor.execute( "SELECT enforcement_id, identity_id FROM Enforcements WHERE user_id = ? AND guild_id = ?", (user.id, guild.id)) return map_rows(self.cursor.fetchone(), Enforcement)
def get_all_user_identities(self, user): self.cursor.execute( "SELECT name, description FROM Identities WHERE user_id = ?", (user.id, )) data = self.cursor.fetchall() return map_rows(data, Identity)
def get_all_guild_enforcements(self, guild): self.cursor.execute( "SELECT user_id, identity_id FROM Enforcements WHERE guild_id = ?", (guild.id, )) return map_rows(self.cursor.fetchall(), Enforcement)
def get_all_relationships_where_user_is_dom(self, user): self.cursor.execute( "SELECT * FROM Relationships WHERE dominant_id = ? AND confirmed = 1", (user.id, )) return map_rows(self.cursor.fetchall(), Relationship)
def get_all_pending_relationships(self, user): self.cursor.execute( "SELECT * FROM Relationships WHERE (submissive_id = ? OR dominant_id = ?) AND confirmed = 0", (user.id, user.id)) return map_rows(self.cursor.fetchall(), Relationship)
def get_relationship(self, dominant, submissive): self.cursor.execute( "SELECT * FROM Relationships WHERE dominant_id = ? AND submissive_id = ?", (dominant.id, submissive.id)) data = self.cursor.fetchone() return map_rows(data, Relationship)
def get_identity_by_id(self, identity_id: int): self.cursor.execute("SELECT * FROM Identities WHERE identity_id = ?", (identity_id, )) return map_rows(self.cursor.fetchone(), Identity)