def execute_command(self, command, slack_id, params, channel):
"""Attempt to run the command with the parameters provided."""
self.acknowledge_command(channel)
synapse_user = self.synapse_user_from_slack_user_id(slack_id)
response = self.registration_prompt(slack_id)
if synapse_user:
try:
response = command(slack_id, synapse_user, params)
except SynapsePayError as e:
response = (
'An HTTP error occurred while trying to communicate with '
'the Synapse API:\n{0}'.format(e.message)
)
except Exception as e:
traceback.print_tb(e.__traceback__)
response = 'An error occurred:\n{0}: {1}'.format(
sys.exc_info()[0],sys.exc_info()[1]
)
return response
评论列表
文章目录