Make MOTD configurable
This commit is contained in:
		
							
								
								
									
										13
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								main.py
									
									
									
									
									
								
							@@ -33,7 +33,8 @@ confArgList = ["", ""]
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
for line in configFile:
 | 
					for line in configFile:
 | 
				
			||||||
    for letter in line:
 | 
					    for letter in line:
 | 
				
			||||||
        if letter == ' ':
 | 
					        if letter == ':':
 | 
				
			||||||
 | 
					            confArgList[confArgNumber] = confArgList[confArgNumber] + ":"
 | 
				
			||||||
            confArgNumber = confArgNumber + 1
 | 
					            confArgNumber = confArgNumber + 1
 | 
				
			||||||
        elif letter == ',':
 | 
					        elif letter == ',':
 | 
				
			||||||
            confArgList.append(",")
 | 
					            confArgList.append(",")
 | 
				
			||||||
@@ -43,12 +44,12 @@ for line in configFile:
 | 
				
			|||||||
                confArgList[confArgNumber] = confArgList[confArgNumber] + letter
 | 
					                confArgList[confArgNumber] = confArgList[confArgNumber] + letter
 | 
				
			||||||
            except Exception:
 | 
					            except Exception:
 | 
				
			||||||
                confArgList.append(letter)
 | 
					                confArgList.append(letter)
 | 
				
			||||||
print(confArgList)
 | 
					 | 
				
			||||||
for word in confArgList:
 | 
					for word in confArgList:
 | 
				
			||||||
    if "\n" in word:
 | 
					    if "\n" in word:
 | 
				
			||||||
        confArgList[confArgList.index(word)] = word.replace("\n", "")
 | 
					        confArgList[confArgList.index(word)] = word.replace("\n", "")
 | 
				
			||||||
 | 
					for word in confArgList:
 | 
				
			||||||
print(confArgList)
 | 
					    if word == "motd:":
 | 
				
			||||||
 | 
					        motd = confArgList[confArgList.index(word) + 1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Write the time to the history file
 | 
					# Write the time to the history file
 | 
				
			||||||
historyFile = open((expanduser("~") + "/.history.mash"), "a")
 | 
					historyFile = open((expanduser("~") + "/.history.mash"), "a")
 | 
				
			||||||
@@ -56,8 +57,8 @@ historyFile.write("\n")
 | 
				
			|||||||
historyFile.write(("Session on " + str(datetime.now())))
 | 
					historyFile.write(("Session on " + str(datetime.now())))
 | 
				
			||||||
historyFile.write("\n")
 | 
					historyFile.write("\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Welcome message. Probably going to be configurable soon enough.
 | 
					# Welcome message. Configurable with "motd: (your motd here),"
 | 
				
			||||||
print("Welcome to Mash, " + user + "@" + socket.gethostname() + "! Mash is currently on version " + version)
 | 
					print(motd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Main loop.
 | 
					# Main loop.
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user