Share your repls and programming experiences

← Back to all posts
Python chatbot
xolyon

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

Voters
BlackComputer1337
ApoorvAgrawal
mkhoi
LOLLIPOP06
Roar123
ARJPEG
xolyon
Comments
hotnewtop
1927829

lol so far I still haven't found a python chat room that works. :|

Anoki21

Yes, I agree to follow these fules.

NarwhalFanatic

Awesome!

Roar123

Nice! Why were you not able to make simultaneous work?

xolyon

@Roar123 no, it just reloaded so fast there was no time to type, you can help me if you want

Roar123

@xolyon ok, sure if I have time.

Roar123

@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:

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:

xolyon

@Roar123 yeah I did the dim thingy because I wanted users to have a personnel color tag until I realised that it might not end up in the txt file that way and would be useless so I forgot to get rid of that piece of code - thanks anyway

imcraft

I wish for my account to be deleted please

xolyon

@imcraft don't worry lol it doesn't even work on the post (it would work if it were on a network, however) do the nothings saved apart from the logins already one there

imcraft

@xolyon oh I thought the ones saved were real lol

xolyon

@imcraft nope I had another program which worked but it crashed whenever you typed in anything so...