Commit 3ea2fe53 authored by Otthorn's avatar Otthorn 🤔

fixed space in author field for quote module

parent fe05d8a1
......@@ -2,7 +2,7 @@ base_quote_file = "citations.txt"
def write_to_db(author, quote, quote_file=base_quote_file):
f = open(quote_file, "a")
f.write(author + " " + quote + "\n")
f.write(author + ";;" + quote + "\n")
f.close()
def load_db(quote_file=base_quote_file):
......@@ -17,9 +17,9 @@ def load_db(quote_file=base_quote_file):
for k in range(len(L)):
L[k] = L[k].strip("\n")
L[k] = L[k].split(" ")
L[k] = L[k].split(";;")
author = L[k][0]
quote = " ".join(L[k][1:])
quote = L[k][1]
if author not in quote_dico.keys():
quote_dico[author] = []
......@@ -29,5 +29,3 @@ def load_db(quote_file=base_quote_file):
print("Quote databse loaded")
return quote_dico
......@@ -131,7 +131,7 @@ def quote_callback(room, event):
def list_quote_callback(room, event):
args = event['content']['body'].split()
author = args[1]
author = " ".join(args[1:])
if author not in quote_dico.keys():
room.send_text("Désolé mais {} est introuvable dans la base de donnée".format(author))
......@@ -139,7 +139,7 @@ def list_quote_callback(room, event):
else:
for quote in quote_dico[author]:
room.send_html("<blockquote>\n{} - {}\n</blockquote>\n".format(quote, author))
room.send_html("<blockquote>\n{} {}\n</blockquote>\n".format(quote, author))
def main():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment