CraftiGames.py 2.2.8__tar.gz → 2.2.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/JartexnetworkWrapper.py +5 -2
  2. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/PikanetworkWrapper.py +5 -2
  3. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Punishments/__init__.py +27 -6
  4. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames.py.egg-info/PKG-INFO +1 -1
  5. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/PKG-INFO +1 -1
  6. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/setup.py +1 -1
  7. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Games/Bedwars.py +0 -0
  8. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Games/Practice.py +0 -0
  9. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Games/Skywars.py +0 -0
  10. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Games/__init__.py +0 -0
  11. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Ratelimits/JartexNetworkRateLimitHandler.py +0 -0
  12. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Ratelimits/PikaNetworkRateLimitHandler.py +0 -0
  13. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Ratelimits/__init__.py +0 -0
  14. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/RefactorAPI/Guilds.py +0 -0
  15. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/RefactorAPI/Leaderboard.py +0 -0
  16. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/RefactorAPI/NetworkStatus.py +0 -0
  17. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/RefactorAPI/Profiles.py +0 -0
  18. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/RefactorAPI/Recaps.py +0 -0
  19. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/RefactorAPI/__init__.py +0 -0
  20. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/ResponseError/__init__.py +0 -0
  21. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Skins/StarlightWrapper.py +0 -0
  22. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Skins/SurgeplayWrapper.py +0 -0
  23. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/Skins/__init__.py +0 -0
  24. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/_Logger/__init__.py +0 -0
  25. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/__init__.py +0 -0
  26. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames/utils.py +0 -0
  27. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames.py.egg-info/SOURCES.txt +0 -0
  28. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames.py.egg-info/dependency_links.txt +0 -0
  29. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames.py.egg-info/requires.txt +0 -0
  30. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/CraftiGames.py.egg-info/top_level.txt +0 -0
  31. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/LICENSE +0 -0
  32. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/MANIFEST.in +0 -0
  33. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/README.md +0 -0
  34. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/requirements.txt +0 -0
  35. {craftigames_py-2.2.8 → craftigames_py-2.2.9}/setup.cfg +0 -0
@@ -593,7 +593,7 @@ class Jartexnetwork:
593
593
  async def Punishment(
594
594
  self,
595
595
  player: str,
596
- type: Literal["ban", "mute", "warn", "kick", "all"] = "all",
596
+ type: Literal["bans", "mutes", "warnings", "kicks", "all"] = "all",
597
597
  list_console: bool = False,
598
598
  **kwargs
599
599
  ) -> Union[dict, None]:
@@ -619,7 +619,10 @@ class Jartexnetwork:
619
619
  async with self.session.get(f'https://jartexnetwork.com/bans/search/{player}/?filter={type}', proxy=proxy) as resp:
620
620
  status = resp.status
621
621
  if status == 200:
622
- return History(await resp.text()).all(list_console=list_console)
622
+ return History(await resp.text()).all(
623
+ list_console=list_console,
624
+ punishment_type=type,
625
+ )
623
626
  elif status == 429 and Recursion <= allowed_recursion:
624
627
  Recursion += 1
625
628
  packages.asyncio.create_task(log('Exceeded ratelimit: ', Recursion, 'X'))
@@ -645,7 +645,7 @@ class Pikanetwork:
645
645
  async def Punishment(
646
646
  self,
647
647
  player: str,
648
- type: Literal["ban", "mute", "warn", "kick", "all"] = "all",
648
+ type: Literal["bans", "mutes", "warnings", "kicks", "all"] = "all",
649
649
  list_console: bool = False,
650
650
  **kwargs: Missing
651
651
  ) -> Union[dict, None]:
@@ -675,7 +675,10 @@ class Pikanetwork:
675
675
  status = resp.status
676
676
 
677
677
  if status == 200:
678
- return History(await resp.text()).all(list_console=list_console)
678
+ return History(await resp.text()).all(
679
+ list_console=list_console,
680
+ punishment_type=type,
681
+ )
679
682
 
680
683
  elif status == 429 and Recursion <= config.allowed_recursion:
681
684
 
@@ -60,21 +60,42 @@ class History:
60
60
 
61
61
  def all(
62
62
  self,
63
- list_console: bool = True
63
+ list_console: bool = True,
64
+ punishment_type: str = "all"
64
65
  ) -> dict:
65
66
 
66
67
  soup = packages.BeautifulSoup(self.__html_parser__, 'html.parser')
67
68
  player = soup.title.string[:-28] if soup.title is not None else "Not found"
68
69
  punishments: dict = {}
69
70
  prow = []
71
+ type_by_filter = {
72
+ "bans": "ban",
73
+ "kicks": "kick",
74
+ "mutes": "mute",
75
+ "warnings": "warning",
76
+ }
70
77
  for row in soup.find_all(class_='row'):
71
78
  row: packages.BeautifulSoup
72
79
 
73
- reason = row.find(class_='_reason').text.strip()
74
- date = row.find(class_='_date').text.strip()
75
- expires = row.find(class_='_expires').text.strip()
76
- ptype = row.find(class_='_type').find('b').text.strip()
77
- by = row.find(class_='user-link').text.strip()
80
+ reason_element = row.find(class_='_reason')
81
+ date_element = row.find(class_='_date')
82
+ staff_element = row.find(class_='user-link')
83
+ if reason_element is None or date_element is None or staff_element is None:
84
+ raise ValueError("Punishment row is missing its reason, date, or staff member.")
85
+
86
+ reason = reason_element.get_text(strip=True)
87
+ date = date_element.get_text(strip=True)
88
+ expires_element = row.find(class_='_expires')
89
+ expires = expires_element.get_text(strip=True) if expires_element else "N/A"
90
+ type_element = row.find(class_='_type')
91
+ ptype = (
92
+ type_element.get_text(strip=True)
93
+ if type_element is not None
94
+ else type_by_filter.get(punishment_type, "")
95
+ )
96
+ if not ptype:
97
+ raise ValueError("Punishment row is missing its type.")
98
+ by = staff_element.get_text(strip=True)
78
99
 
79
100
  if list_console is False and by.lower() == 'console':
80
101
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CraftiGames.py
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: A Python based API wrapper for CraftiGames community
5
5
  Home-page: https://github.com/sti1ltyping/CraftiGames.py
6
6
  Author: sti1ltyping
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CraftiGames.py
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: A Python based API wrapper for CraftiGames community
5
5
  Home-page: https://github.com/sti1ltyping/CraftiGames.py
6
6
  Author: sti1ltyping
@@ -9,7 +9,7 @@ with open('README.md') as README_file:
9
9
 
10
10
  setup(
11
11
  name='CraftiGames.py',
12
- version='2.2.8',
12
+ version='2.2.9',
13
13
  author='sti1ltyping',
14
14
  author_email='sti1ltyping.chillax@gmail.com',
15
15
  url='https://github.com/sti1ltyping/CraftiGames.py',
File without changes
File without changes
File without changes