Browse Source

debug output folder renamed to self.output

pull/5/head
manetta 6 years ago
parent
commit
a75e02a47b
  1. 5
      logbot.py

5
logbot.py

@ -76,7 +76,7 @@ class MUCBot(slixmpp.ClientXMPP):
# Save the image to the output folder # Save the image to the output folder
url = msg['oob']['url'] # grep the url in the message url = msg['oob']['url'] # grep the url in the message
filename = os.path.basename(url) # grep the filename in the url filename = os.path.basename(url) # grep the filename in the url
output_path = os.path.join(output, filename) output_path = os.path.join(self.output, filename)
u = urllib.request.urlopen(url) # read the image data u = urllib.request.urlopen(url) # read the image data
f = open(output_path, 'wb') # open the output file f = open(output_path, 'wb') # open the output file
f.write(u.read()) # write image to file f.write(u.read()) # write image to file
@ -101,9 +101,8 @@ class MUCBot(slixmpp.ClientXMPP):
# Add message to log # Add message to log
message = '<p class="message">{}</p>'.format(msg['body'].replace('@bot','')) message = '<p class="message">{}</p>'.format(msg['body'].replace('@bot',''))
output = self.output
log = 'log.html' log = 'log.html'
log_path = os.path.join(output, log) log_path = os.path.join(self.output, log)
f = open(log_path, 'a+') f = open(log_path, 'a+')
f.write(message+'\n') f.write(message+'\n')
f.close() f.close()

Loading…
Cancel
Save