Python chatbot
xolyon (142)

Hi everyone this is what you make on 5th day of quarantine

this took way too long as I tried to make it run simultaneously but that didn't work

I also tried to make it encrypted with a separate program I already wrote but for some reason, it wouldn't work here

-- - intro - --

  • if you don't have an 'account' create one then log in
  • don't steal someone's else account
  • Select an option
  • just chat!

-- - how it works - --

  • login just reads line by line until it matches username and password

  • the chat system uses a function which reads the last 5 lines (i had a system which printed every time it got altered but it didn't work)

-- - updates - --
I might add the encryption along with some cool tags and other stuff

You are viewing a single comment. View All
Roar123 (137)

@xolyon I made some minor tweaks to your program and made it simultaneous. First of all, I simplified the while loop at the bottom of main.py to:

while True:
	chat_print()
	chat(player_name)
	
	Clear()

Yep that's it! Some other tweaks you can also make are changing the amount of lines read from chat.txt from 5 to 10 and adding a reset ANSI escape code so the entire chat does not become dim. Btw, I'm using f-string formatting which is really nice and efficient. Check it out! Example:

reset = "\033[0m"
def chat(n):
    chatting = input(f"{Style.DIM}type something in the chat!")
    print(f"{reset}")
    # everything else . . .