Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
7

Python chatbot

xolyon
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

3 years ago

Voters

Comments

TopNew
1
1927829
1927829

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

2 years ago
1
Anoki21
Anoki21

Yes, I agree to follow these fules.

3 years ago
1
Roar123
Roar123

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

3 years ago
1
xolyon
xolyon

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

3 years ago
1
Roar123
Roar123

@xolyon
ok, sure if I have time.

3 years ago
1
Roar123
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:

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 . . .
3 years ago
1
xolyon
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

3 years ago
1
imcraft
imcraft

I wish for my account to be deleted please

3 years ago
1
xolyon
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

3 years ago
1
imcraft
imcraft

@xolyon
oh I thought the ones saved were real lol

3 years ago
1
xolyon
xolyon

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

3 years ago
Load more