-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_example.py
40 lines (32 loc) · 933 Bytes
/
basic_example.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
import time, sys, configparser
from discoIPC import ipc
config = configparser.ConfigParser()
config.read('config.ini')
base_activity = {
'assets': {
'large_image': 'example-big',
'large_text': 'Example big',
'small_image': 'example-small',
'small_text': 'Example small',
},
'timestamps': {}
}
timeElapsed = int(time.time())
client = ipc.DiscordIPC(config['CLIENT']['client_id'])
client.connect()
print('\nStarting ICP...\n')
def set_activity():
activity = base_activity
activity['details'] = 'Example'
activity['state'] = 'example'
activity['timestamps']['start'] = timeElapsed
return activity
try:
while True:
print('Sending data ...')
client.update_activity(set_activity())
time.sleep(5) # Send data every second seconds
except KeyboardInterrupt:
print('Disconnecting Discord ICP ...\n')
client.disconnect()
sys.exit()