import slackminion.slack


class SlackEvent(object):
    _channel = None
    """Encapsulates an event received from the RTM socket"""

    def __init__(self, event_type, **payload):
        self.event_type = event_type
        self.rtm_client = payload.get('rtm_client')
        self.web_client = payload.get('web_client')
        self.data = payload.get('data')
        self.subtype = payload.get('subtype')
        self.user_id = self.data.get('user')
        self.channel_id = self.data.get('channel')

    @property
    def channel(self):
        if self._channel:
            return self._channel
        return self.channel_id

    @channel.setter
    def channel(self, channel):
        self._channel = channel

    @property
    def text(self):
        if 'text' in self.data:
            return self.data['text']
        elif 'message' in self.data:
            return self.data['message'].get('text', '')

    @property
    def ts(self):
        if 'message' in self.data:
            return self.data['message'].get('ts')
        elif 'ts' in self.data:
            return self.data['ts']

    @property
    def thread_ts(self):
        if 'message' in self.data:
            return self.data['message'].get('thread_ts')
        elif 'thread_ts' in self.data:
            return self.data['ts']

    def __repr__(self):
        return f'SlackEvent type {self.event_type} User: {self.user_id}'

@@ -953,151 +953,34 @@
     
-if 'message' in self.data:%0A            return self.data%5B'message'%5D.get('ts')%0A        elif 'ts' in self.data:%0A            return self.data%5B'ts'%5D
+return self.data.get('ts')
 %0A%0A  

fix thread_ts