Update monitoring function to include channel declaration.

master
jowj 6 years ago
parent 91e11c41da
commit 47eaac7220

@ -131,11 +131,11 @@ def react_to_message(reaction):
def react_to_monitoring(): def react_to_monitoring():
results_file = Path("/results.json") results_file = Path("/results.json")
if results_file.is_file(): if results_file.is_file():
results_file = open("/results.json","r") open_file = open("/results.json","r")
for line in results_file: for line in open_file:
slack_client.api_call( slack_client.api_call(
"chat.postMessage", "chat.postMessage",
get_channel_ID("bots-like-gaston"), channel = get_channel_ID("bots-like-gaston"),
text=line text=line
) )
os.remove("/results.json") os.remove("/results.json")
@ -162,7 +162,7 @@ if __name__ == "__main__":
if command: if command:
handle_command(command, channel) handle_command(command, channel)
if results_file.is_file(): if results_file.is_file():
logging.info("the if statement passed!") logging.info("results_file ifstatement passed!")
react_to_monitoring() react_to_monitoring()
if reactable_message(event): if reactable_message(event):
channel = event['channel'] channel = event['channel']

Loading…
Cancel
Save