|
|
|
@ -128,17 +128,17 @@ def react_to_message(reaction):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def react_to_monitoring(filename):
|
|
|
|
|
results_file = os.Path("results.json")
|
|
|
|
|
def react_to_monitoring():
|
|
|
|
|
results_file = Path("/results.json")
|
|
|
|
|
if results_file.is_file():
|
|
|
|
|
results_file = open(filename,"r")
|
|
|
|
|
results_file = open("/results.json","r")
|
|
|
|
|
for line in results_file:
|
|
|
|
|
slack_client.api_call(
|
|
|
|
|
"chat.postMessage",
|
|
|
|
|
get_channel_ID("bots-like-gaston"),
|
|
|
|
|
text=line
|
|
|
|
|
)
|
|
|
|
|
os.remove(filename)
|
|
|
|
|
os.remove("/results.json")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_channel_ID(channelName):
|
|
|
|
@ -151,7 +151,6 @@ def get_channel_ID(channelName):
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
logging.basicConfig(filename='mojojojo.log', level=logging.INFO)
|
|
|
|
|
logging.info('Started')
|
|
|
|
|
results_file = Path("results.json")
|
|
|
|
|
if slack_client.rtm_connect(with_team_state=False):
|
|
|
|
|
print("mojo jojo online, connected, and running!")
|
|
|
|
|
# Read bot's user ID by calling Web API method `auth.test`
|
|
|
|
@ -162,7 +161,7 @@ if __name__ == "__main__":
|
|
|
|
|
if command:
|
|
|
|
|
handle_command(command, channel)
|
|
|
|
|
if results_file.is_file():
|
|
|
|
|
react_to_monitoring(results_file)
|
|
|
|
|
react_to_monitoring()
|
|
|
|
|
if reactable_message(event):
|
|
|
|
|
channel = event['channel']
|
|
|
|
|
text = event['text']
|
|
|
|
|