-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
25 lines (24 loc) · 1.03 KB
/
main.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
import requests, os
while True:
os.system("cls")
print("TermChat\n\nPlease choose a channel:")
print(requests.get("https://termchat.t0mcat.repl.co/channels").text.replace(",", "\n")+"\n")
channel = input("Channel name: ")
username = input("Username to log in as: ")
while True:
os.system("cls")
print("TermChat\n")
print(requests.get(f"https://termchat.t0mcat.repl.co/get?channel={channel.lower()}").text)
print("Choose a command:\nsend\nchangechannel\nreload\nexit\n")
command = input("> ")
if command.lower() == "send":
texttosend = input("Text to send: ")
requests.post("https://termchat.t0mcat.repl.co/send", data={"username": username, "message": texttosend, "channel": channel.lower()})
elif command.lower() == "changechannel":
break
elif command.lower() == "reload":
pass
elif command.lower() == "exit":
os.system("cls")
print("Bye!")
quit()