Skip to content

Commit 0fb8213

Browse files
committed
Add Carbon Service
1 parent 02a3c92 commit 0fb8213

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ See more examples [here](/examples).
110110
- [botlist.space](https://botlist.space) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.BotListSpace))
111111
- [botsfordiscord.com](https://botsfordiscord.com) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.BotsForDiscord))
112112
- [b-o-d.cf](https://b-o-d.cf) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.BotsOfDiscord))
113+
- [carbonitex.net](https://www.carbonitex.net/Discord/bots) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.Carbon))
113114
- [top.gg](https://top.gg) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.TopGG))
114115
- [discord.bots.gg](https://discord.bots.gg) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.DiscordBotsGG))
115116
- *More services will be supported in a future release...*

dbots/service.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,43 @@ def get_user(self, user_id: str) -> HTTPResponse:
425425
path = f'/users/{user_id}'
426426
)
427427

428+
class Carbon(Service):
429+
"""
430+
Represents the Carbonitex service.
431+
432+
.. seealso::
433+
- `Carbonitex Website <https://www.carbonitex.net/Discord/bots/>`_
434+
"""
435+
436+
BASE_URL = 'https://www.carbonitex.net/discord'
437+
438+
@staticmethod
439+
def aliases() -> list:
440+
return ['carbonitex', 'carbonitex.net', 'carbon']
441+
442+
@staticmethod
443+
def _post(
444+
http_client: HTTPClient, token: str,
445+
server_count = 0
446+
) -> HTTPResponse:
447+
return http_client.request(
448+
method = 'POST',
449+
path = f'{BotsOfDiscord.BASE_URL}/data/botdata.php',
450+
json = {
451+
'key': token,
452+
'servercount': server_count
453+
}
454+
)
455+
456+
def get_bots(self) -> HTTPResponse:
457+
"""|httpres|\n
458+
Gets a list of bots on this service.
459+
"""
460+
return self._request(
461+
method = 'GET',
462+
path = '/api/listedbots'
463+
)
464+
428465
class DiscordBotsGG(Service):
429466
"""
430467
Represents the Discord Bots service.

docs/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Services
5858
.. autoclass:: BotsOfDiscord
5959
:members:
6060

61+
.. autoclass:: Carbon
62+
:members:
63+
6164
.. autoclass:: DiscordBotsGG
6265
:members:
6366

0 commit comments

Comments
 (0)