# Path: sirbot/slack/store/user.py
# class User(SlackItem):
# 
#     def __init__(self, id_, raw=None, dm_id=None, last_update=None,
#                  deleted=False):
#         """
#         Class representing a slack user.
# 
#         :param id_: id of the user
#         """
# 
#         super().__init__(id_, raw, last_update)
#         self.dm_id = dm_id
#         self.deleted = deleted
# 
#     @property
#     def admin(self):
#         return self._raw.get('is_admin', False)
# 
#     @admin.setter
#     def admin(self, _):
#         raise NotImplementedError
# 
#     @property
#     def bot(self):
#         return self._raw.get('is_bot', False)
# 
#     @bot.setter
#     def bot(self, _):
#         raise NotImplementedError
# 
#     @property
#     def bot_id(self):
#         return self._raw.get('profile', {}).get('bot_id', '')
# 
#     @bot_id.setter
#     def bot_id(self, _):
#         raise NotImplementedError
# 
#     @property
#     def send_id(self):
#         return self.dm_id
# 
# Path: sirbot/slack/errors.py
# class SlackMessageError(SlackError):
#     """Generic slack message error"""


import json
import logging
import asyncio
from ..user import User
from ...errors import SlackMessageError
    @property
    def thread_callback(self):
        return self._thread_callback

    @thread_callback.setter
    def thread_callback(self, func):

        if isinstance(func, tuple):
            func, user_id = func
        else:
            user_id = True

        if not asyncio.iscoroutine(func):
            func = asyncio.coroutine(func)
        self._thread_callback = (func, user_id)

    def serialize(self, type_='send', to='rtm'):

        if type_ == 'response':
            data = self.content.serialize(attachment_type='string')
            data['response_type'] = self.response_type
            data['replace_original'] = self.replace_original
        else:
            data = self.content.serialize(attachment_type='json')

        if to == 'event' and isinstance(self.to, User):
            data['channel'] = '@' + self.to.name
        else:
            data['channel'] = self.to.send_id


# Path: sirbot/slack/store/user.py
# class User(SlackItem):
# 
#     def __init__(self, id_, raw=None, dm_id=None, last_update=None,
#                  deleted=False):
#         """
#         Class representing a slack user.
# 
#         :param id_: id of the user
#         """
# 
#         super().__init__(id_, raw, last_update)
#         self.dm_id = dm_id
#         self.deleted = deleted
# 
#     @property
#     def admin(self):
#         return self._raw.get('is_admin', False)
# 
#     @admin.setter
#     def admin(self, _):
#         raise NotImplementedError
# 
#     @property
#     def bot(self):
#         return self._raw.get('is_bot', False)
# 
#     @bot.setter
#     def bot(self, _):
#         raise NotImplementedError
# 
#     @property
#     def bot_id(self):
#         return self._raw.get('profile', {}).get('bot_id', '')
# 
#     @bot_id.setter
#     def bot_id(self, _):
#         raise NotImplementedError
# 
#     @property
#     def send_id(self):
#         return self.dm_id
# 
# Path: sirbot/slack/errors.py
# class SlackMessageError(SlackError):
#     """Generic slack message error"""


# Path: sirbot/slack/store/message/message.py
import json
import logging
import asyncio
from ..user import User
from ...errors import SlackMessageError

    @property
    def thread_callback(self):
        return self._thread_callback

    @thread_callback.setter
    def thread_callback(self, func):

        if isinstance(func, tuple):
            func, user_id = func
        else:
            user_id = True

        if not asyncio.iscoroutine(func):
            func = asyncio.coroutine(func)
        self._thread_callback = (func, user_id)

    def serialize(self, type_='send', to='rtm'):

        if type_ == 'response':
            data = self.content.serialize(attachment_type='string')
            data['response_type'] = self.response_type
            data['replace_original'] = self.replace_original
        else:
            data = self.content.serialize(attachment_type='json')

        if to == 'event' and isinstance(self.to, User):
            data['channel'] = '@' + self.to.name
        else:
            data['channel'] = self.to.send_id


        if self.timestamp: