Skip to content

Commit

Permalink
fix: remove locale as cogs will not start
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroquinc committed May 3, 2024
1 parent e62e6c3 commit 6ed842d
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions services/profile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
from config.config import BASE_URL
import time
import locale

locale.setlocale(locale.LC_ALL, 'nl_NL')

class Profile:
"""
A class to represent a Profile.
"""

def __init__(self, data: dict):
"""
Constructs all the necessary attributes for the Game object.
Parameters
----------
data : dict
The data dictionary containing all the game details.
"""
self.user = data.get('User', "N/A")
self.user_pic = f"{BASE_URL}{data.get('UserPic', '')}"
self.user_pic_unique = f"{self.user_pic}?timestamp={int(time.time())}"
Expand All @@ -28,4 +36,15 @@ def __init__(self, data: dict):
self.motto = data.get('Motto', "N/A")

def format_points(self, points: int) -> str:
return locale.format_string("%d", points, grouping=True).replace(',', '.') if points >= 10000 else str(points)
"""
Formats the points with commas as thousands separators.
Parameters
----------
points : int
The points to be formatted.
Returns
-------
str
The formatted points.
"""
return format(points, ',').replace(',', '.') if points >= 10000 else str(points)

0 comments on commit 6ed842d

Please sign in to comment.