Mar-21-2020, 04:19 PM
Hey,
I've created my own program, and i want my program's user's discord, to be telling that he is 'playing' my program while he is running it. I've created a function (set_discord_status) wich sets the user's discord status to: 'playing Storm Aio'. But this is a loop.. And i want this loop to run at the same time as my program. I've created a other loop (loop) wich demonstrates my program. And so, I want my program (loop - in this case) to run at the same time as the loop wich sets my discord status. i've created the code below but when I run that. It will set the discord status, but it won't run the other loop...
Does someone know what i did wrong?
I've created my own program, and i want my program's user's discord, to be telling that he is 'playing' my program while he is running it. I've created a function (set_discord_status) wich sets the user's discord status to: 'playing Storm Aio'. But this is a loop.. And i want this loop to run at the same time as my program. I've created a other loop (loop) wich demonstrates my program. And so, I want my program (loop - in this case) to run at the same time as the loop wich sets my discord status. i've created the code below but when I run that. It will set the discord status, but it won't run the other loop...
Does someone know what i did wrong?
from threading import Thread import rpc import time def set_discord_status(): # This is a function wich sets my discord status to a specific game client_id = '689533785343000590' rpc_obj = rpc.DiscordIpcClient.for_platform(client_id) start_time = time.time() while True: activity = { "state": "Beta version: 0.0.1", "details": "Taking stock...", "timestamps": { "start": start_time }, "assets": { "small_text": "Light", "small_image": "little", "large_text": "StormAIO", "large_image": "default" } } rpc_obj.set_activity(activity) def loop(): # This is a loop just to test if they can run at the same time while True: print('hoi') Thread(target=set_discord_status()).start() Thread(target=loop()).start()