Skip to content

Commit bd01016

Browse files
committed
Fix critical posting bugs
1 parent a472f25 commit bd01016

File tree

2 files changed

+67
-27
lines changed

2 files changed

+67
-27
lines changed

dbots/poster.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ async def manual_post(
234234
if len(self.api_keys) == 0:
235235
raise APIKeyException('No API Keys available')
236236
if not service or len(service) == 0:
237-
responses = {}
237+
responses = []
238238
keys = list(self.api_keys.keys())
239239
if hasattr(self, 'on_custom_post'):
240240
keys.append('custom')
@@ -251,8 +251,10 @@ async def manual_post(
251251
raise APIKeyException(f'Service {service} has no API key')
252252
try:
253253
response = await _service._post(
254-
self.http, self.client_id, key, server_count, user_count,
255-
voice_connections, self.shard_id, self.shard_count
254+
self.http, self.client_id, key,
255+
server_count=server_count, user_count=user_count,
256+
voice_connections=voice_connections,
257+
shard_id=self.shard_id, shard_count=self.shard_count
256258
)
257259
log.debug('Posted to %s: %s', response.raw.url, response.body)
258260
self.dispatch('post', response)
@@ -323,6 +325,4 @@ def shard_id(self) -> int or None:
323325

324326
@property
325327
def shard_count(self) -> int or None:
326-
return self._shard_count or self.filler.shard_count if self._sharding else None
327-
328-
328+
return self._shard_count or self.filler.shard_count if self._sharding else None

dbots/service.py

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ def aliases() -> list:
119119
def _post(
120120
http_client: HTTPClient, bot_id: str, token: str,
121121
server_count = 0, user_count = 0,
122-
shard_count: int = None, shard_id: int = None
122+
voice_connections = 0, shard_count: int = None,
123+
shard_id: int = None
123124
) -> HTTPResponse:
124125
payload = {
125126
'server_count': server_count,
@@ -152,7 +153,9 @@ def aliases() -> list:
152153
@staticmethod
153154
def _post(
154155
http_client: HTTPClient, bot_id: str, token: str,
155-
server_count = 0
156+
server_count = 0, user_count = 0,
157+
voice_connections = 0, shard_count: int = None,
158+
shard_id: int = None
156159
) -> HTTPResponse:
157160
return http_client.request(
158161
method = 'POST',
@@ -279,7 +282,9 @@ def aliases() -> list:
279282
@staticmethod
280283
def _post(
281284
http_client: HTTPClient, bot_id: str, token: str,
282-
server_count = 0
285+
server_count = 0, user_count = 0,
286+
voice_connections = 0, shard_count: int = None,
287+
shard_id: int = None
283288
) -> HTTPResponse:
284289
return http_client.request(
285290
method = 'POST',
@@ -375,7 +380,8 @@ def aliases() -> list:
375380
@staticmethod
376381
def _post(
377382
http_client: HTTPClient, bot_id: str, token: str,
378-
server_count = 0, shard_count: int = None,
383+
server_count = 0, user_count = 0,
384+
voice_connections = 0, shard_count: int = None,
379385
shard_id: int = None
380386
) -> HTTPResponse:
381387
payload = { 'server_count': server_count }
@@ -444,7 +450,9 @@ def aliases() -> list:
444450
@staticmethod
445451
def _post(
446452
http_client: HTTPClient, bot_id: str, token: str,
447-
server_count = 0
453+
server_count = 0, user_count = 0,
454+
voice_connections = 0, shard_count: int = None,
455+
shard_id: int = None
448456
) -> HTTPResponse:
449457
return http_client.request(
450458
method = 'POST',
@@ -502,7 +510,9 @@ def aliases() -> list:
502510
@staticmethod
503511
def _post(
504512
http_client: HTTPClient, bot_id: str, token: str,
505-
server_count = 0
513+
server_count = 0, user_count = 0,
514+
voice_connections = 0, shard_count: int = None,
515+
shard_id: int = None
506516
) -> HTTPResponse:
507517
return http_client.request(
508518
method = 'POST',
@@ -541,6 +551,8 @@ def aliases() -> list:
541551
def _post(
542552
http_client: HTTPClient, bot_id: str, token: str,
543553
server_count = 0, user_count = 0,
554+
voice_connections = 0, shard_count: int = None,
555+
shard_id: int = None
544556
) -> HTTPResponse:
545557
return http_client.request(
546558
method = 'POST',
@@ -584,7 +596,9 @@ def aliases() -> list:
584596
@staticmethod
585597
def _post(
586598
http_client: HTTPClient, bot_id: str, token: str,
587-
server_count = 0,
599+
server_count = 0, user_count = 0,
600+
voice_connections = 0, shard_count: int = None,
601+
shard_id: int = None
588602
) -> HTTPResponse:
589603
return http_client.request(
590604
method = 'POST',
@@ -642,7 +656,10 @@ def aliases() -> list:
642656

643657
@staticmethod
644658
def _post(
645-
http_client: HTTPClient, bot_id: str, token: str
659+
http_client: HTTPClient, bot_id: str, token: str,
660+
server_count = 0, user_count = 0,
661+
voice_connections = 0, shard_count: int = None,
662+
shard_id: int = None
646663
) -> HTTPResponse:
647664
raise PostingUnsupported()
648665

@@ -810,7 +827,8 @@ def aliases() -> list:
810827
@staticmethod
811828
def _post(
812829
http_client: HTTPClient, bot_id: str, token: str,
813-
server_count = 0, shard_count: int = None,
830+
server_count = 0, user_count = 0,
831+
voice_connections = 0, shard_count: int = None,
814832
shard_id: int = None
815833
) -> HTTPResponse:
816834
payload = { 'guildCount': server_count }
@@ -878,7 +896,9 @@ def aliases() -> list:
878896
@staticmethod
879897
def _post(
880898
http_client: HTTPClient, bot_id: str, token: str,
881-
server_count = 0
899+
server_count = 0, user_count = 0,
900+
voice_connections = 0, shard_count: int = None,
901+
shard_id: int = None
882902
) -> HTTPResponse:
883903
return http_client.request(
884904
method = 'POST',
@@ -965,7 +985,9 @@ def aliases() -> list:
965985
@staticmethod
966986
def _post(
967987
http_client: HTTPClient, bot_id: str, token: str,
968-
server_count = 0
988+
server_count = 0, user_count = 0,
989+
voice_connections = 0, shard_count: int = None,
990+
shard_id: int = None
969991
) -> HTTPResponse:
970992
return http_client.request(
971993
method = 'POST',
@@ -1099,7 +1121,9 @@ def aliases() -> list:
10991121
@staticmethod
11001122
def _post(
11011123
http_client: HTTPClient, bot_id: str, token: str,
1102-
server_count = 0
1124+
server_count = 0, user_count = 0,
1125+
voice_connections = 0, shard_count: int = None,
1126+
shard_id: int = None
11031127
) -> HTTPResponse:
11041128
return http_client.request(
11051129
method = 'POST',
@@ -1193,7 +1217,9 @@ def aliases() -> list:
11931217
@staticmethod
11941218
def _post(
11951219
http_client: HTTPClient, bot_id: str, token: str,
1196-
server_count = 0
1220+
server_count = 0, user_count = 0,
1221+
voice_connections = 0, shard_count: int = None,
1222+
shard_id: int = None
11971223
) -> HTTPResponse:
11981224
return http_client.request(
11991225
method = 'POST',
@@ -1306,7 +1332,9 @@ def aliases() -> list:
13061332
@staticmethod
13071333
def _post(
13081334
http_client: HTTPClient, bot_id: str, token: str,
1309-
server_count = 0
1335+
server_count = 0, user_count = 0,
1336+
voice_connections = 0, shard_count: int = None,
1337+
shard_id: int = None
13101338
) -> HTTPResponse:
13111339
return http_client.request(
13121340
method = 'POST',
@@ -1374,7 +1402,9 @@ def aliases() -> list:
13741402
@staticmethod
13751403
def _post(
13761404
http_client: HTTPClient, bot_id: str, token: str,
1377-
server_count = 0
1405+
server_count = 0, user_count = 0,
1406+
voice_connections = 0, shard_count: int = None,
1407+
shard_id: int = None
13781408
) -> HTTPResponse:
13791409
return http_client.request(
13801410
method = 'POST',
@@ -1458,7 +1488,8 @@ def aliases() -> list:
14581488
@staticmethod
14591489
def _post(
14601490
http_client: HTTPClient, bot_id: str, token: str,
1461-
server_count = 0, shard_count: int = None,
1491+
server_count = 0, user_count = 0,
1492+
voice_connections = 0, shard_count: int = None,
14621493
shard_id: int = None
14631494
) -> HTTPResponse:
14641495
payload = { 'guild_count': server_count }
@@ -1597,7 +1628,9 @@ def aliases() -> list:
15971628
@staticmethod
15981629
def _post(
15991630
http_client: HTTPClient, bot_id: str, token: str,
1600-
server_count = 0
1631+
server_count = 0, user_count = 0,
1632+
voice_connections = 0, shard_count: int = None,
1633+
shard_id: int = None
16011634
) -> HTTPResponse:
16021635
return http_client.request(
16031636
method = 'POST',
@@ -1695,7 +1728,9 @@ def aliases() -> list:
16951728
@staticmethod
16961729
def _post(
16971730
http_client: HTTPClient, bot_id: str, token: str,
1698-
server_count = 0
1731+
server_count = 0, user_count = 0,
1732+
voice_connections = 0, shard_count: int = None,
1733+
shard_id: int = None
16991734
) -> HTTPResponse:
17001735
return http_client.request(
17011736
method = 'POST',
@@ -1763,7 +1798,9 @@ def aliases() -> list:
17631798
@staticmethod
17641799
def _post(
17651800
http_client: HTTPClient, bot_id: str, token: str,
1766-
server_count = 0, user_count = 0
1801+
server_count = 0, user_count = 0,
1802+
voice_connections = 0, shard_count: int = None,
1803+
shard_id: int = None
17671804
) -> HTTPResponse:
17681805
return http_client.request(
17691806
method = 'POST',
@@ -1956,7 +1993,8 @@ def aliases() -> list:
19561993
@staticmethod
19571994
def _post(
19581995
http_client: HTTPClient, bot_id: str, token: str,
1959-
server_count = 0, shard_count: int = None,
1996+
server_count = 0, user_count = 0,
1997+
voice_connections = 0, shard_count: int = None,
19601998
shard_id: int = None
19611999
) -> HTTPResponse:
19622000
payload = { 'serveurs': server_count }
@@ -2015,7 +2053,9 @@ def aliases() -> list:
20152053
@staticmethod
20162054
def _post(
20172055
http_client: HTTPClient, bot_id: str, token: str,
2018-
server_count = 0
2056+
server_count = 0, user_count = 0,
2057+
voice_connections = 0, shard_count: int = None,
2058+
shard_id: int = None
20192059
) -> HTTPResponse:
20202060
return http_client.request(
20212061
method = 'POST',

0 commit comments

Comments
 (0)