-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom_service.py
51 lines (37 loc) · 1.09 KB
/
custom_service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import dbots
class CustomService(dbots.Service):
@staticmethod
def aliases():
return ['customservice']
@staticmethod
def _post(
http_client, bot_id, token, server_count=0, user_count=0,
voice_connections=0, shard_count=None, shard_id=None
):
payload = {
'server_count': server_count,
'user_count': user_count,
'voice_connections': voice_connections
}
if shard_id and shard_count:
payload['shard_id'] = shard_id
payload['shard_count'] = shard_count
return http_client.request(
method='POST',
path='http://httpbin.org/post',
query={'id': bot_id},
headers={'Authorization': token},
json=payload
)
dbots.Service.SERVICES.append(CustomService)
client_id = '1234567890'
def server_count():
return 100
def user_count():
return 100
def voice_connections():
return 0
poster = dbots.Poster(
client_id, server_count, user_count, voice_connections, api_keys={
'customservice': '…'
})