Exemple #1
0
 def __init__(self, nickname, realname, user_id, channels, target_group,
              nickserv_pw):
     self.nickname = '{}-slack'.format(utils.strip_nick(nickname))
     self.realname = realname
     self.user_id = user_id
     self.channels = channels
     self.nickserv_password = nickserv_pw
     self.target_group_nick = target_group
Exemple #2
0
 def _format_message(self, message):
     match_ids = re.findall(r'(<\@([A-Z0-9]{9,})\>)', message)
     # Avoid duplicate searches for multiple users mentions
     # in the same Slack message.
     for replace, uid in set(match_ids):
         user_info = next(
             (user for user in self.slack_users if user['id'] == uid),
             None,
         )
         if user_info:
             target_nick = '{}-slack'.format(
                 utils.strip_nick(user_info['name']), )
             message = message.replace(replace, target_nick)
     return message
Exemple #3
0
    def __init__(
        self,
        sc: SlackClient,
        nickname: str,
        realname: str,
        user_id: str,
        joined_channels: List[str],
        target_group: str,
        nickserv_pw: str,
    ):
        intended_nickname = '{}-slack'.format(utils.strip_nick(nickname))

        self.sc = sc
        self.slack_name = nickname
        self.intended_nickname = intended_nickname
        self.realname = realname
        self.user_id = user_id
        self.joined_channels = joined_channels
        self.target_group_nick = target_group
        self.im_id = None

        super().__init__(sc, intended_nickname, nickserv_pw)
Exemple #4
0
    def __init__(
        self,
        sc,
        nickname,
        realname,
        user_id,
        joined_channels,
        target_group,
        nickserv_pw,
    ):
        intended_nickname = '{}-slack'.format(utils.strip_nick(nickname))

        self.sc = sc
        self.slack_name = nickname
        self.intended_nickname = intended_nickname
        self.realname = realname
        self.user_id = user_id
        self.joined_channels = joined_channels
        self.target_group_nick = target_group
        self.im_id = None

        super().__init__(sc, intended_nickname, nickserv_pw)