I would like to know how I can make this irc ‘bot’ log to a text file.
I used:
text_file = open("log.txt", "w")
text_file.write(ircmsg +"\r\n")
text_file.close()
The problem is that this code will make new input overwrite the textfile, while I want every new input a new line in the same text file.
(I know there are ‘made bots’ on the internet, but I prefer making it myself.)
You are opening file in ‘write’ mode which would override file each time
Open in ‘append’ mode i.e use
'a'instead of'w'More details here http://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files