def _music(self):
        """
        Command /music
        Gets the links sent by all the users of the chat in the last week
        and group them by user>links
        """
        days = 7
        now = datetime.datetime.now()
        last_week_timedelta = datetime.timedelta(days=days)

        last_week_links = defaultdict(list)

        try:
            username = self.command_args[0]
            username = username.replace('@', '')
            links = Link.select() \
                .join(Chat, on=(Chat.id == Link.chat)) \
                .join(User, on=(User.id == Link.user)) \
                .where((Chat.id == self.update.message.chat_id) & (User.username == username)) \
                .where((Link.created_at >= now - last_week_timedelta) | (Link.updated_at >= now - last_week_timedelta)) \
                .order_by(Link.updated_at.asc(), Link.created_at.asc())

        except IndexError:
            links = Link.select() \
                .join(Chat) \
                .where(Chat.id == self.update.message.chat_id) \
                .where((Link.created_at >= now - last_week_timedelta) | (Link.updated_at >= now - last_week_timedelta)) \
                .order_by(Link.updated_at.asc(), Link.created_at.asc())

        for link in links:
            last_week_links[link.user].append(link)
        last_week_links = dict(last_week_links)

        self.responser.reply_music(last_week_links)
    def _music_from_beginning(self):
        """
        Command /music_from_beginning @username
        Gets the links sent by an specific username of the chat from the beginning
        """
        all_time_links = defaultdict(list)

        try:
            username = self.command_args[0]
            username = username.replace('@', '')
        except IndexError:
            self.responser.error_music_from_beginning_no_username()
            return

        links = Link.select() \
            .join(Chat, on=(Chat.id == Link.chat)) \
            .join(User, on=(User.id == Link.user)) \
            .where((Chat.id == self.update.message.chat_id) & (User.username == username)) \
            .order_by(Link.updated_at.asc(), Link.created_at.asc())

        if len(links) == 0:
            self.responser.error_no_links_found(username)
            return

        for link in links:
            all_time_links[link.user].append(link)
        all_time_links = dict(all_time_links)

        self.responser.reply_music_from_beginning(all_time_links)