Skip to content

Commit dcd5a0e

Browse files
committed
Add Arcane service
1 parent 6e64945 commit dcd5a0e

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ See more examples [here](/examples).
106106
## Services
107107

108108
### Supported Services
109+
- [arcane-center.xyz](https://arcane-center.xyz) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.Arcane))
109110
- [botlist.space](https://botlist.space) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.BotListSpace))
110111
- [botsfordiscord.com](https://botsfordiscord.com) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.BotsForDiscord))
111112
- [top.gg](https://top.gg) ([docs](https://dbots.readthedocs.io/en/latest/api.html#dbots.TopGG))

dbots/service.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,44 @@ def __repr__(self):
9696

9797
###############################
9898

99+
class Arcane(Service):
100+
"""
101+
Represents the Arcane Bot Center service.
102+
103+
.. seealso::
104+
- `Arcane Bot Center Website <https://arcane-center.xyz/>`_
105+
- `Arcane Bot Center API Documentation <https://arcane-center.xyz/documentation>`_
106+
"""
107+
108+
BASE_URL = 'https://arcane-center.xyz/api'
109+
110+
@staticmethod
111+
def aliases() -> list:
112+
return [
113+
'arcanebotcenter', 'arcanecenter', 'arcane-botcenter.xyz', 'arcanebotcenter.xyz',
114+
'arcane-center.xyz', 'arcanecenter.xyz', 'arcane', 'abc'
115+
]
116+
117+
@staticmethod
118+
def _post(
119+
http_client: HTTPClient, bot_id: str, token: str,
120+
server_count = 0, user_count = 0,
121+
voice_connections = 0, shard_count: int = None,
122+
shard_id: int = None
123+
) -> HTTPResponse:
124+
payload = {
125+
'server_count': server_count,
126+
'member_count': user_count,
127+
}
128+
if shard_id and shard_count:
129+
payload['shard_count'] = shard_count
130+
return http_client.request(
131+
method = 'POST',
132+
path = f'{Arcane.BASE_URL}/{bot_id}/stats',
133+
headers = { 'Authorization': token },
134+
json = payload
135+
)
136+
99137
class BotListSpace(Service):
100138
"""
101139
Represents the botlist.space service.
@@ -531,5 +569,5 @@ def get_widget_url(self, bot_id: str, small_widget: str = None, **query) -> str:
531569
return f'{TopGG.BASE_URL}/widget/{subpath}{bot_id}.svg?{_encode_query(query)}'
532570

533571
Service.SERVICES = [
534-
BotListSpace, BotsForDiscord, DiscordBotsGG, TopGG
572+
Arcane, BotListSpace, BotsForDiscord, DiscordBotsGG, TopGG
535573
]

docs/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ HTTP Classes
4646
Services
4747
--------
4848

49+
.. autoclass:: Arcane
50+
:members:
51+
4952
.. autoclass:: BotListSpace
5053
:members:
5154

0 commit comments

Comments
 (0)