def get_top_karma_server(self, guildId, pageSize, page): karma = Karma.select() \ .where(Karma.guild == guildId) \ .order_by(Karma.karma.desc()) \ .paginate(page, paginate_by=pageSize) \ .execute() return karma
def _fetch_karma(self, clientId, guildId): karma = Karma.select() \ .where((Karma.client == clientId) & (Karma.guildId == guildId)) \ .first() return karma
def get_user_karma_all(self, clientId): karma = Karma.select(fn.SUM(Karma.karma).alias("karmaSum")) \ .where((Karma.client == clientId)) \ .first() return karma
def get_user_karma(self, guildId, clientId): karma = Karma.select() \ .where((Karma.guild == guildId) & (Karma.client == clientId)) \ .first() return karma
def get_user_avaiable_karma(self, clientId, guildId): karma = Karma.select(Karma.avaiable_karma) \ .where((Karma.client_id == clientId) & (Karma.guild == guildId)) \ .first() return karma.avaiable_karma
def check_user_has_karma(self, userId, guildId): result = Karma.select().where((Karma.guild == guildId) & (Karma.client == userId)) \ .exists() return result