I am trying to make a simple chat system with my small, smooth, goofy ahh brain but the thing is, it's too goofy ahh. I need to print()
while taking user input (input()
).
def check():
url = 'https://SwelteringTrimClasslibrary.aterx.repl.co/new_msg'
r = eval(requests.get('https://SwelteringTrimClasslibrary.aterx.repl.co/new_msg').text)
if not (r['auth'] == User.username):
if not(r['cont'] == Message.content):
setMessage(r['auth'], r['cont'])
print(f'{Message.author}: {Message.content}')
def mainloop():
msg = input('> ')
setMessage(User.username, msg)
print(f'{Message.author}: {Message.content}')
url = 'https://SwelteringTrimClasslibrary.aterx.repl.co/new_msg'
requests.post(url, data={'auth': Message.author, 'cont': Message.content})
while True:
t1 = Thread(target=check)
t2 = Thread(target=mainloop)
t1.start()
t2.start()
t1.join()
t2.join()